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]
Other format: [Raw text]

Re: driver/9517: makefile dependencies deleted on error, option -MMD


Hi,

$ cat x.cpp
#include "x.h"
$ cat x.h
syntax error
$ gcc -v
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/3.2/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit i486-suse-linux
Thread model: posix
gcc version 3.2

$ strace g++ -MMD -c -o x.o x.cpp
execve("/usr/bin/g++", ["g++", "-MMD", "-c", "-o", "x.o", "x.cpp"], [/* 56 vars */]) = 0
...
fork()                                  = 9307
wait4(-1, [WIFEXITED(s) && WEXITSTATUS(s) == 1], 0, NULL) = 9307
--- SIGCHLD (Child exited) ---
stat64("x.d", {st_mode=S_IFREG|0600, st_size=15, ...}) = 0
unlink("x.d")                           = 0

cc1plus:
...
open("x.d", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
fstat64(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x1556b000
write(3, "x.o: x.cpp x.h\n", 15)        = 15
close(3)                                = 0


So cc1plus creates the file x.d, and g++ deletes it after it gets exitstaus == 1.
I also tried gcc and cc1, the result is the same.

I have included the specs file.

Ralf Friedl

bangerth at dealii dot org schrieb:

> Synopsis: makefile dependencies deleted on error, option -MMD
>
> State-Changed-From-To: open->feedback
> State-Changed-By: bangerth
> State-Changed-When: Fri Mar 14 02:15:28 2003
> State-Changed-Why:
>     I can't reproduce this behavior: the .d file is always
>     created for me, irrespective of errors in .h or .c files.
>     Can you send us the transcript of a shell session that
>     shows this behavior?
>
>     Thanks
>       Wolfgang
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9517
*asm:
%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}

*asm_debug:
%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}

*asm_final:
%|

*asm_options:
%a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}

*invoke_as:
%{!S:-o %{|!pipe:%g.s} |
 as %(asm_options) %{!pipe:%g.s} %A }

*cpp:
%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}

*cpp_options:
%(cpp_unique_options) %{std*} %{d*} %{W*} %{w} %{pedantic*} %{fshow-column} %{fno-show-column} %{fsigned-char&funsigned-char} %{fleading-underscore} %{fno-leading-underscore} %{fno-operator-names} %{ftabstop=*}

*cpp_unique_options:
%{C:%{!E:%eGNU C does not support -C without using -E}} %{nostdinc*} %{C} %{v} %{I*} %{P} %{$} %I %{MD:-MD %W{!o: %b.d}%W{o*:%.d%*}} %{MMD:-MMD %W{!o: %b.d}%W{o*:%.d%*}} %{M} %{MM} %W{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}} %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3 -D__GXX_ABI_VERSION=102} %{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs} %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}} %{fno-inline|O0|!O*:-D__NO_INLINE__} %{ffast-math:-D__FAST_MATH__} %{fshort-wchar:-U__WCHAR_TYPE__ -D__WCHAR_TYPE__=short\ unsigned\ int} %{ffreestanding:-D__STDC_HOSTED__=0} %{fno-hosted:-D__STDC_HOSTED__=0} %{!ffreestanding:%{!fno-hosted:-D__STDC_HOSTED__=1}} %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{E|M|MM:%W{o*}}

*trad_capable_cpp:
%{traditional|ftraditional|traditional-cpp:trad}cpp0

*cc1:
%(cc1_cpu) %{profile:-p}

*cc1_options:
%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %1 %{!Q:-quiet} -dumpbase %B %{d*} %{m*} %{a*} %{g*} %{O*} %{W*} %{w} %{pedantic*} %{std*} %{ansi} %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} %{Qn:-fno-ident} %{--help:--help} %{--target-help:--target-help} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*}

*cc1plus:
-fmessage-length=0

*link_gcc_c_sequence:
%G %L %G

*endfile:
%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s

*link:
%{!static:--eh-frame-hdr} -m elf_i386 %{shared:-shared}   %{!shared:     %{!ibcs:       %{!static: 	%{rdynamic:-export-dynamic} 	%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} 	%{static:-static}}}

*lib:
%{shared: -lc}    %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} 	%{profile:-lc_p} %{!profile: -lc}}

*libgcc:
%{static|static-libgcc:-lgcc -lgcc_eh}%{!static:%{!static-libgcc:%{!shared:%{!shared-libgcc:-lgcc -lgcc_eh}%{shared-libgcc:-lgcc_s%M -lgcc}}%{shared:%{shared-libgcc:-lgcc_s%M}%{!shared-libgcc:-lgcc}}}}

*startfile:
%{!shared:      %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} 		       %{!p:%{profile:gcrt1.o%s} 			 %{!profile:crt1.o%s}}}}    crti.o%s %{static:crtbeginT.o%s}   %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}

*switches_need_spaces:


*predefines:
-D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -Asystem=posix

*cross_compile:
0

*version:
3.2

*multilib:
. ;

*multilib_defaults:


*multilib_extra:


*multilib_matches:


*multilib_exclusions:


*linker:
collect2

*link_libgcc:
%D

*md_exec_prefix:


*md_startfile_prefix:


*md_startfile_prefix_1:


*startfile_prefix_spec:


*cpp_cpu_default:
-D__tune_i486__

*cpp_cpu:
%(cpp_cpu32) %(cpp_cpucommon)

*cpp_cpu32:
-Acpu=i386 -Amachine=i386 %{!ansi:%{!std=c*:%{!std=i*:-Di386}}} -D__i386 -D__i386__ %(cpp_cpu32sizet)

*cpp_cpu64:
-Acpu=x86_64 -Amachine=x86_64 -D__x86_64 -D__x86_64__ %(cpp_cpu64sizet)

*cpp_cpu32sizet:


*cpp_cpu64sizet:


*cpp_cpucommon:
%{march=i386:%{!mcpu*:-D__tune_i386__ }}%{march=i486:-D__i486 -D__i486__ %{!mcpu*:-D__tune_i486__ }}%{march=pentium|march=i586:-D__i586 -D__i586__ -D__pentium -D__pentium__   %{!mcpu*:-D__tune_i586__ -D__tune_pentium__ }}%{march=pentium-mmx:-D__i586 -D__i586__ -D__pentium -D__pentium__   -D__pentium__mmx__   %{!mcpu*:-D__tune_i586__ -D__tune_pentium__ -D__tune_pentium_mmx__}}%{march=pentiumpro|march=i686:-D__i686 -D__i686__   -D__pentiumpro -D__pentiumpro__   %{!mcpu*:-D__tune_i686__ -D__tune_pentiumpro__ }}%{march=k6:-D__k6 -D__k6__ %{!mcpu*:-D__tune_k6__ }}%{march=k6-2:-D__k6 -D__k6__ -D__k6_2__   %{!mcpu*:-D__tune_k6__ -D__tune_k6_2__ }}%{march=k6-3:-D__k6 -D__k6__ -D__k6_3__   %{!mcpu*:-D__tune_k6__ -D__tune_k6_3__ }}%{march=athlon|march=athlon-tbird:-D__athlon -D__athlon__   %{!mcpu*:-D__tune_athlon__ }}%{march=athlon-4|march=athlon-xp|march=athlon-mp:-D__athlon -D__athlon__   -D__athlon_sse__   %{!mcpu*:-D__tune_athlon__ -D__tune_athlon_sse__ }}%{march=pentium4:-D__pentium4 -D__pentium4__ %{!mcpu*:-D__tune_pentium4__ }}%{m386|mcpu=i386:-D__tune_i386__ }%{m486|mcpu=i486:-D__tune_i486__ }%{mpentium|mcpu=pentium|mcpu=i586|mcpu=pentium-mmx:-D__tune_i586__ -D__tune_pentium__ }%{mpentiumpro|mcpu=pentiumpro|mcpu=i686|cpu=pentium2|cpu=pentium3:-D__tune_i686__ -D__tune_pentiumpro__ }%{mcpu=k6|mcpu=k6-2|mcpu=k6-3:-D__tune_k6__ }%{mcpu=athlon|mcpu=athlon-tbird|mcpu=athlon-4|mcpu=athlon-xp|mcpu=athlon-mp:-D__tune_athlon__ }%{mcpu=athlon-4|mcpu=athlon-xp|mcpu=athlon-mp:-D__tune_athlon_sse__ }%{mcpu=pentium4:-D__tune_pentium4__ }%{march=athlon-xp|march=athlon-mp|march=pentium3|march=pentium4:-D__SSE__ }%{march=pentium-mmx|march=k6|march=k6-2|march=k6-3|march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp|march=athlon-mp|march=pentium2|march=pentium3|march=pentium4: -D__MMX__ }%{march=k6-2|march=k6-3|march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp|march=athlon-mp: -D__3dNOW__ }%{march=athlon|march=athlon-tbird|march=athlon-4|march=athlon-xp|march=athlon-mp: -D__3dNOW_A__ }%{march=pentium4: -D__SSE2__ }%{!march*:%{!mcpu*:%{!m386:%{!m486:%{!mpentium*:%(cpp_cpu_default)}}}}}

*cc1_cpu:
%{!mcpu*: %{m386:-mcpu=i386 %n`-m386' is deprecated. Use `-march=i386' or `-mcpu=i386' instead.
} %{m486:-mcpu=i486 %n`-m486' is deprecated. Use `-march=i486' or `-mcpu=i486' instead.
} %{mpentium:-mcpu=pentium %n`-mpentium' is deprecated. Use `-march=pentium' or `-mcpu=pentium' instead.
} %{mpentiumpro:-mcpu=pentiumpro %n`-mpentiumpro' is deprecated. Use `-march=pentiumpro' or `-mcpu=pentiumpro' instead.
}} %{mintel-syntax:-masm=intel %n`-mintel-syntax' is deprecated. Use `-masm=intel' instead.
} %{mno-intel-syntax:-masm=att %n`-mno-intel-syntax' is deprecated. Use `-masm=att' instead.
}

*link_command:
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:    %(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t}    %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}    %{static:} %{L*} %(link_libgcc) %o %{!nostdlib:%{!nodefaultlibs:%(link_gcc_c_sequence)}}    %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}


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