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

            Bug ID: 85165
           Summary: gcc (and g++) not complaining about few unknown file
                    extensions like *.CC, *.Cc, *.cC
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kiran0802 at gmail dot com
  Target Milestone: ---

When compiling the following test case i.e. test.CC, GCC (6.4.0 ver)
is not generating any warning and moreover respective object file is generated.
 I think this while compiling a file with any unknown file extension, GCC
should generate a warning i.e. "test.CC: file not recognized: File truncated". 

Steps to reproduce:
create a file with .CC extension and compile it with either gcc or g++ as shown
below.

with gcc-6.4.0 version:(compiler NOT generating any warnings for unknown file
extensions)
-------------------------------------------------------------------------
% touch test.CC
% gcc test.CC
/usr/lib/gcc/i686-pc-cygwin/6.4.0/../../../libcygwin.a(libcmain.o): In function
`main':
/usr/src/debug/cygwin-2.10.0-1/winsup/cygwin/lib/libcmain.c:37: undefined
reference to `WinMain@16'
collect2: error: ld returned 1 exit status

From above messages, it seems that the compiler has
recognized/considered/assumed .CC file extension as a valid extension and
further processing is done.

% gcc -c test.CC

There is no warning generated from the compiler and respective object file i.e.
test.o generated.

Note:
I had also tried with other file extensions such as .Cc and .cC and observed
the same behavior as above.
g++ is also behaving in the same way as gcc.

with gcc-4.8.0 version:(compiler is generated warnings as expected)
-------------------------------------------------------------------
% gcc test.CC
test.CC: file not recognized: File truncated
collect2: ld returned 1 exit status

I had also tried to invoke only compiler i.e. with -c option
% gcc -c test.CC
gcc: test.CC: linker input file unused because linking not done

% gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

From my understanding, gcc support following file extenstions:
.ada, .adb., .c, .C, .c++, .cc, .class, .cp, .cpp, .CPP, .cxx, etc.
As .CC, .Cc and .cC are not in the above list, compiler should generate
respective warning message.

Reply via email to