[Bug c/63462] New: [RFC] gcc should prevent from overwriting source file

wkoszek at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Oct 5 20:46:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63462

            Bug ID: 63462
           Summary: [RFC] gcc should prevent from overwriting source file
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wkoszek at gmail dot com

Suggestion: prevent GCC from overwriting source code files when invoked as:

gcc source.c -o source.c

Background: I use command completion heavily. Very often while in coding mood I
do:

gcc myfile.c -o myf<TAB>

not to type "myfile", which is long. But after completion kicks in, I sometimes
forget to do <BACKSPACE><BACKSPACE>.

And .c file gets overwritten.

It'd be nice to have GCC catch this. And if you really want to do it, maybe run
GCC with: --yes-im-sure-i-want-to-overwrite-my-source-code switch.



More information about the Gcc-bugs mailing list