Bug 23351 - *cpp specs file options are sometimes ignored
Summary: *cpp specs file options are sometimes ignored
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: driver (show other bugs)
Version: 4.0.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-12 11:00 UTC by Matti Rintala
Modified: 2012-01-11 14:18 UTC (History)
2 users (show)

See Also:
Host: sparc-sun-solaris2.8
Target: sparc-sun-solaris2.8
Build: sparc-sun-solaris2.8
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matti Rintala 2005-08-12 11:01:02 UTC
Consider the following additional specs file, test.specs:
*cpp:
+ -I testing

Using that to preprocess a trivial C++ file (containing just an empty main())
produces the following output (Note that "-I testing" is missing):
******************
[cppbug]$ cpp -v -specs=test.specs t.cc
Reading specs from
/share/local/lang/gcc401-sol8/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.1/specs
Reading specs from test.specs
Target: sparc-sun-solaris2.8
Configured with: ../../gcc-4.0.1/configure --prefix=/usr/local/lang/gcc401-sol8
--enable-shared --with-local-prefix=/opt/local --enable-cpp
--enable-threads=posix --with-gnu-ld
--with-ld=/usr/local/lang/gcc401-sol8/bin/ld --with-gnu-as
--with-as=/usr/local/lang/gcc401-sol8/bin/as --disable-nls --disable-multilib
--enable-languages=c,c++ --enable-c99
Thread model: posix
gcc version 4.0.1
 /share/local/lang/gcc401-sol8/bin/../libexec/gcc/sparc-sun-solaris2.8/4.0.1/cc1plus
-E -quiet -v -iprefix
/share/local/lang/gcc401-sol8/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.1/ t.cc
-mcpu=v7
... (rest of output omitted)
*****************

For C preprocessing, the -I option is added properly (the last line):
*****************
[cppbug]$ cpp -v -specs=test.specs t.c
Reading specs from
/share/local/lang/gcc401-sol8/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.1/specs
Reading specs from test.specs
Target: sparc-sun-solaris2.8
Configured with: ../../gcc-4.0.1/configure --prefix=/usr/local/lang/gcc401-sol8
--enable-shared --with-local-prefix=/opt/local --enable-cpp
--enable-threads=posix --with-gnu-ld
--with-ld=/usr/local/lang/gcc401-sol8/bin/ld --with-gnu-as
--with-as=/usr/local/lang/gcc401-sol8/bin/as --disable-nls --disable-multilib
--enable-languages=c,c++ --enable-c99
Thread model: posix
gcc version 4.0.1
 /share/local/lang/gcc401-sol8/bin/../libexec/gcc/sparc-sun-solaris2.8/4.0.1/cc1
-E -quiet -v -iprefix
/share/local/lang/gcc401-sol8/bin/../lib/gcc/sparc-sun-solaris2.8/4.0.1/
-idirafter /opt/local/include -I testing t.c -mcpu=v7
****************

My linux (i686-pc-linux-gnu) build properly addes the options from *cpp in both
cases.

This bug does not only affect the cpp command but also normal C ja C++
compilations in the sun environment.
Comment 1 Andrew Pinski 2005-08-12 13:31:59 UTC
SPECs are really internal to GCC.
Comment 2 Matti Rintala 2005-08-12 13:39:51 UTC
Subject: Re:  *cpp specs file options are sometimes ignored
 in Sun builds

pinskia at gcc dot gnu dot org wrote:

>------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-12 13:31 -------
>SPECs are really internal to GCC.
>
>  
>
? I am not sure I understand you reply. We have to provide additional
system-wide compiler flags for gcc (-I include paths, linker options
etc.). We are using the specs file for that purpose, and I understood
from the documentation that this is still possible in 4.0.1 by using the
-dumpspecs option to get  a copy of the internal specs file, and then
modify that. Is there something wrong with this approach?

Comment 3 Andrew Pinski 2005-08-12 22:33:03 UTC
You can set env variables per user.

See <http://gcc.gnu.org/onlinedocs/gcc-4.0.1/gcc/Environment-Variables.html#Environment-
Variables>
Comment 4 Matti Rintala 2005-08-23 12:47:09 UTC
(In reply to comment #3)
> You can set env variables per user.

Are you saying that specs files and specs options are not supported in current
gcc and that they should not be used for any purpose?


Comment 5 Andrew Pinski 2005-08-23 12:49:28 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > You can set env variables per user.
> 
> Are you saying that specs files and specs options are not supported in current
> gcc and that they should not be used for any purpose?

No what I am saying is that they are not designed for what you are doing.
Comment 6 Richard Biener 2012-01-11 14:18:19 UTC
Indeed.