This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Problem with "" vs <> headers and fixincludes
- From: Douglas B Rupp <rupp at adacore dot com>
- To: gcc at gcc dot gnu dot org
- Cc: bkorb at gnu dot org
- Date: Thu, 1 Jun 2017 16:24:03 +0200
- Subject: Problem with "" vs <> headers and fixincludes
- Authentication-results: sourceware.org; auth=none
This is a reproducer for a problem we have with fixincludes on
vxworks6.6. The desired output is
FOO= 1
The problem is the rules for handling headers enclosed in quotes can
cause gcc to #include the original header not the patched header.
It seems like a problem that could theoretically occur on any target, so
what is the solution (other than copying each and every header into
include-fixed)?
--Douglas Rupp
AdaCore
=======================================================
test1.c:
-----------------
#include <stdio.h>
#include <foo.h>
void
main ()
{
printf ("FOO= %d\n", FOO);
}
Header subdirs:
--------
h/foo.h:
#include "arch/x86.h"
h/arch/x86.h
#define FOO 0
include-fixed/h/
include-fixed/h/arch/x86.h
#define FOO 1
Execution
----------
$ gcc -c -Iinclude-fixed/h -Ih test1.c
$ gcc -o test1 test1.o
$ ./test1
FOO= 0