On 9 May 2012 00:38, Joseph S. Myers <[email protected]> wrote: > On Wed, 9 May 2012, Manuel López-Ibáñez wrote: > >> which looks correct to me. However, the build fails because now >> options.h requires input.h which requires line-map.h, which is not >> included when building for example libgcc. options.h is included by >> tm.h, so it basically appears everywhere. >> >> Any suggestions how to fix this? > > options.h already has some #if !defined(IN_LIBGCC2) && > !defined(IN_TARGET_LIBS) && !defined(IN_RTS) conditionals, so you could > arrange for some more such conditionals to be generated.
This works great for libgcc, however, ada's runtime library is
compiled with IN_GCC and includes options.h through tm.h, so it
breaks:
../../xgcc -B../../ -c -DIN_GCC -g -O2 -W -Wall \
-iquote /home/manuel/test2/src/gcc \
-iquote . -iquote .. -iquote ../.. -iquote
/home/manuel/test2/src/gcc/ada -iquote /home/manuel/test2/src/gcc
-I/home/manuel/test2/src/gcc/../include \
../rts/targext.c -o targext.o
In file included from ../../options.h:3716:0,
from ../../tm.h:19,
from ../rts/targext.c:50:
/home/manuel/test2/src/gcc/input.h:25:22: fatal error: line-map.h: No
such file or directory
#include "line-map.h"
^
That tm.h includes the whole options.h is bad, but I don't want to
mess with it. So I am instead only including input.h if options.h was
not included from tm.h. This requires surprisingly few changes.
The other major issue is that if -Wunused is enabled by -Wall, it has
to be enabled by handle_generated_option, so I need to modify every
front-end that does that . In the future, we should also generate
per-FE _auto function, but I didn't want to make this patch even
larger.
Bootstrapped and regression tested.
OK?
2012-05-09 Manuel López-Ibáñez <[email protected]>
PR 53063
gcc/
* doc/options.texi (EnabledBy): Document
* opts.c: Include opts.h and options.h before tm.h.
(finish_options): Do not handle some sub-options here...
(common_handle_option): ... instead call common_handle_option_auto here.
* optc-gen.awk: Handle EnabledBy.
* opth-gen.awk: Declare common_handle_option_auto.
* common.opt (Wuninitialized): Use EnabledBy. Delete Init.
(Wmaybe-uninitialized): Likewise.
(Wunused-but-set-variable): Likewise.
(Wunused-function): Likewise.
(Wunused-label): Likewise.
(Wunused-value): Likewise.
(Wunused-variable): Likewise.
* opt-read.awk: Create opt_numbers array.
ada/
* gcc-interface/misc.c (gnat_parse_file): Move before ...
(gnat_handle_option): ... this. Use handle_generated_option.
c-family/
* c-opts.c (c_common_handle_option): Use handle_generated_option
to enable sub-options.
fortran/
* options.c: Include diagnostics.h instead of
diagnostics-core.h.
(set_Wall): Do not see warn_unused here.
(gfc_handle_option): Set it here using handle_generated_option.
group-options-2.diff
Description: Binary data
