This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

preprocessor/1903: cpp (2.95.3) does not create proper dependencies for .c++ source file extensions



>Number:         1903
>Category:       preprocessor
>Synopsis:       cpp (2.95.3) does not create proper dependencies for .c++ source file extensions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 07 12:46:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     tkunze@zack.com
>Release:        GNU CPP version 2.95.3 19991030 (prerelease) (i386 Linux/ELF)
>Organization:
>Environment:
Linux time.zacknetwork.com 2.2.17-21mdksmp #1 SMP Thu Oct 5 13:03:01 CEST 2000 i686 unknown
no specific environment settings
>Description:
Execute

  % echo "#define FOO x" > foo.h
  % echo "#include \"foo.h\"\nint FOO = 1;" > foo.c++
  % gcc -E -Wp,-M foo.c++
  foo.c++.o: foo.c++ foo.h
  %

"foo.c++.o:" is the wrong tag (".c++" extension is not 
recognized).

Changing the extension from ".c++" to ".cpp" works as 
expected:

  % cp foo.c++ foo.cpp
  % gcc -E -Wp,-M foo.cpp
  foo.o: foo.cpp foo.h
  %

I consider this a bug since gcc recognizes ".c++" extensions
but cpp apparently not.  Invoking cpp directly with -lang-c++
doesn't help either.

-Tobias
>How-To-Repeat:
see above under "Description"
>Fix:
None.  For automake, adding

# make cpp recognize our c++ extensions 
%.o: %.c++
	@echo '$(CXXCOMPILE) -c $<'; \
	$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
	@-sed 's/^\([^:]*\)\.c++\.o[ 	]*:/\1.o :/' \
          < .deps/$(*F).pp > .deps/$(*F).P; \
	tr ' ' '\012' < .deps/$(*F).pp \
	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
	    >> .deps/$(*F).P; \
	rm .deps/$(*F).pp

%.lo: %.c++
	@echo '$(LTCXXCOMPILE) -c $<'; \
	$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
	@-sed -e 's/^\([^:]*\)\.c++\.o[ 	]*:/\1.lo \1.o :/' \
	  < .deps/$(*F).pp > .deps/$(*F).P; \
	tr ' ' '\012' < .deps/$(*F).pp \
	  | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
	    >> .deps/$(*F).P; \
	rm -f .deps/$(*F).pp

to Makefile.am "fixes" the shortcoming.
>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]