On 06/25/2009 10:42 AM, Bruce Simpson wrote:
> Ben Greear wrote:
>>>
>>> The #ident pragma is useful as it's a compiler mandated way of embedding
>>> object IDs in which can then be retrieved using the 'ident' command from
>>> binutils (or compatible toolchains). It even works with MinGW in
>>> Windows.
>>
>> What would you use this for?
>
> Traceability -- knowing exactly which compiled objects went into a
> binary from a build.
>
> Typically more useful in production builds, not as useful for debug
> builds, where this information is redundantly coded anyway.
If you moved to something like 'git' for the repository, you could just
use the HEAD tag or similar and encode that once in the binary
somewhere. Only with cvs would you need to know the version
for every file.
>>> Whilst #ident is not part of the current ISO C++ standard, it has been
>>> generally supported by most UNIX C++ compilers for years. So this
>>> strikes me more as a regression on Fedora's part.
>>>
>>> Can we be sure that this isn't due to a change in Fedora's shipped gcc
>>> spec file?
>>
>> [gree...@ben-dt2 git]$ gcc --version
>> gcc (GCC) 4.4.0 20090506 (Red Hat 4.4.0-4)
>> Copyright (C) 2009 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.
>
> What about -dumpspec ?
[gree...@ben-dt2 xorp]$ gcc -dumpspecs
*asm:
%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} %{m32:--32}
%{m64:--64} %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}
*asm_debug:
%{!g0:%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}}
%{fdebug-prefix-map=*:--debug-prefix-map %*}
*asm_final:
*asm_options:
%{--target-help:%:print-asm-header()} %a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o
%d%w%u%O}
*invoke_as:
%{!S:-o %|.s |
as %(asm_options) %|.s %A }
*cpp:
%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}
*cpp_options:
%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}
%{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}
%{undef}
%{save-temps:-fpch-preprocess}
*cpp_debug_options:
%{d*}
*cpp_unique_options:
%{C|CC:%{!E:%eGCC does not support -C or -CC without -E}} %{!Q:-quiet}
%{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}}
%{MMD:-MMD
%{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*}
%{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}} %{remap}
%{g3|ggdb3|gstabs3|gcoff3|gxcoff3|gvms3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i
%{fmudflap:-D_MUDFLAP -include mf-runtime.h} %{fmudflapth:-D_MUDFLAP
-D_MUDFLAPTH
-include mf-runtime.h} %{E|M|MM:%W{o*}}
*trad_capable_cpp:
cc1 -E %{traditional|ftraditional|traditional-cpp:-traditional-cpp}
*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*} %{c|S:%{o*:-auxbase-strip
%*}%{!o*:-auxbase %b}}%{!c:%{!S:-auxbase %b}} %{g*} %{O*} %{W*&pedantic*} %{w}
%{std*&ansi&trigraphs} %{v:-version} %{pg:-p} %{p} %{f*} %{undef}
%{Qn:-fno-ident} %{--help:--help} %{--target-help:--target-help}
%{--help=*:--help=%(VALUE)} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}}
%{fsyntax-only:-o %j}
%{-param*} %{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants}
%{coverage:-fprofile-arcs -ftest-coverage}
*cc1plus:
*link_gcc_c_sequence:
%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}
*link_ssp:
%{fstack-protector:}
*endfile:
%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s}
%{mpc32:crtprec32.o%s} %{mpc64:crtprec64.o%s} %{mpc80:crtprec80.o%s}
%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s
*link:
%{!static:--eh-frame-hdr} %{!r:--build-id} %{!m32:-m elf_x86_64} %{m32:-m
elf_i386} --hash-style=gnu %{shared:-shared} %{!shared: %{!static:
%{rdynamic:-export-dynamic} %{m32:%{!dynamic-linker:-dynamic-linker
%{muclibc:%{mglibc:%e-mglibc and -muclibc used
together}/lib/ld-uClibc.so.0;:/lib/ld-linux.so.2}}}
%{!m32:%{!dynamic-linker:-dynamic-linker %{muclibc:%{mglibc:%e-mglibc and
-muclibc used
together}/lib/ld64-uClibc.so.0;:/lib64/ld-linux-x86-64.so.2}}}}
%{static:-static}}
*lib:
%{pthread:-lpthread} %{shared:-lc} %{!shared:%{mieee-fp:-lieee}
%{profile:-lc_p}%{!profile:-lc}}
*mfwrap:
%{static: %{fmudflap|fmudflapth: --wrap=malloc --wrap=free --wrap=calloc
--wrap=realloc --wrap=mmap --wrap=munmap --wrap=alloca} %{fmudflapth:
--wrap=pthread_create}} %{fmudflap|fmudflapth: --wrap=main}
*mflib:
%{fmudflap|fmudflapth: -export-dynamic}
*link_gomp:
*libgcc:
%{static|static-libgcc:-lgcc
-lgcc_eh}%{!static:%{!static-libgcc:%{!shared-libgcc:-lgcc --as-needed -lgcc_s
--no-as-needed}%{shared-libgcc:-lgcc_s%{!shared:
-lgcc}}}}
*startfile:
%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} crti.o%s
%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}
*switches_need_spaces:
*cross_compile:
0
*version:
4.4.0
*multilib:
. !m64 !m32;64:../lib64 m64 !m32;32:../lib !m64 m32;
*multilib_defaults:
m64
*multilib_extra:
*multilib_matches:
m64 m64;m32 m32;
*multilib_exclusions:
*multilib_options:
m64/m32
*linker:
collect2
*link_libgcc:
%D
*md_exec_prefix:
*md_startfile_prefix:
*md_startfile_prefix_1:
*startfile_prefix_spec:
*sysroot_spec:
--sysroot=%R
*sysroot_suffix_spec:
*sysroot_hdrs_suffix_spec:
*cc1_cpu:
%{mcpu=*:-mtune=%* %n`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
} %<mcpu=* %{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.
}%{march=native:%<march=native %:local_cpu_detect(arch)
%{!mtune=*:%<mtune=native %:local_cpu_detect(tune)}}
%{mtune=native:%<mtune=native
%:local_cpu_detect(tune)}
*link_command:
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %l %{pie:-pie} %X %{o*}
%{A} %{d} %{e*} %{m} %{N} %{n} %{r} %{s} %{t} %{u*} %{x} %{z} %{Z}
%{!A:%{!nostdlib:%{!nostartfiles:%S}}} %{static:} %{L*} %(mfwrap)
%(link_libgcc) %o
%{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}
%(mflib) %{fprofile-arcs|fprofile-generate|coverage:-lgcov}
%{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}
%{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}
>
>>
>> I've no particular idea why it complains. It seems to be only a
>> warning, but
>> I think xorp is using -Werr or something like that. Seemed easier to
>> comment
>> out all the idents instead of digging further as I wasn't aware of any
>> useful
>> features derived from #ident.
>
> Which warning(s) are specifically triggered?
For instance:
[gree...@ben-dt2 xorp]$ make
make all-recursive
make[1]: Entering directory `/home/greearb/git/xorp'
Making all in libxorp
make[2]: Entering directory `/home/greearb/git/xorp/libxorp'
make all-am
make[3]: Entering directory `/home/greearb/git/xorp/libxorp'
/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I..
-g -Werror -W -Wall -Wwrite-strings -Wbad-function-cast -Wmissing-prototypes
-Wcast-qual -Wmissing-declarations -Wpointer-arith -Wcast-align
-Wstrict-prototypes -Wnested-externs -pipe -MT debug.lo -MD -MP -MF
.deps/debug.Tpo -c -o
debug.lo debug.c
gcc -DHAVE_CONFIG_H -I. -I.. -I.. -g -Werror -W -Wall -Wwrite-strings
-Wbad-function-cast -Wmissing-prototypes -Wcast-qual -Wmissing-declarations
-Wpointer-arith -Wcast-align -Wstrict-prototypes -Wnested-externs -pipe -MT
debug.lo -MD -MP -MF .deps/debug.Tpo -c debug.c -o debug.o
debug.c:23:2: error: #ident is a deprecated GCC extension
make[3]: *** [debug.lo] Error 1
make[3]: Leaving directory `/home/greearb/git/xorp/libxorp'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/greearb/git/xorp/libxorp'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/greearb/git/xorp'
make: *** [all] Error 2
[gree...@ben-dt2 xorp]$
Thanks,
Ben
>
>
> thans,
> BMS
--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com
_______________________________________________
Xorp-hackers mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers