This is the mail archive of the gcc-patches@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]

[PATCH] PR/18555


This patch fixes PR 18555 by fixing existing -isysroot support. I am also adding two test cases. -isysroot allows user to override system root used during header search.

2004-11-22 Devang Patel <dpatel@apple.com>

        PR/18555
        * gcc.h (DEFAULT_WORD_SWITCH_TAKES_ARG): Add isysroot.
        * config/darwin-c.c (darwin_register_frameworks): Use sysroot.

testsuite
* gcc.dg/cpp/isysroot-1.c: New test.
* gcc.dg/cpp/usr/include/stdio.h: New file.
* gcc.dg/cpp/isysroot-2.c: New test.
* gcc.dg/cpp/System/Library/Framework/Carbon.framework/Headers/Carbon.h:
New file.


Bootstrapped and tested on powerpc-darwin.
OK?
-
Devang

[mindhola.apple.com:~/patch_collection/fsf]$ cat pr18555.diff
Index: gcc/gcc.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.h,v
retrieving revision 1.18
diff -Idpatel.pbxuser -c -3 -p -r1.18 gcc.h
*** gcc/gcc.h 15 Oct 2004 14:47:06 -0000 1.18
--- gcc/gcc.h 22 Nov 2004 22:03:26 -0000
*************** struct spec_function
*** 49,54 ****
--- 49,55 ----
|| !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \
|| !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \
|| !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \
+ || !strcmp (STR, "isysroot") \
|| !strcmp (STR, "-param") || !strcmp (STR, "specs") \
|| !strcmp (STR, "MF") || !strcmp (STR, "MT") || !strcmp (STR, "MQ"))


Index: gcc/config/darwin-c.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin-c.c,v
retrieving revision 1.15
diff -Idpatel.pbxuser -c -3 -p -r1.15 darwin-c.c
*** gcc/config/darwin-c.c       18 Sep 2004 19:19:30 -0000  1.15
--- gcc/config/darwin-c.c       22 Nov 2004 22:03:26 -0000
*************** darwin_register_objc_includes (const cha
*** 468,474 ****
     frameworks had been registered.  */

void
! darwin_register_frameworks (const char *sysroot ATTRIBUTE_UNUSED,
const char *iprefix ATTRIBUTE_UNUSED, int stdinc)
{
if (stdinc)
--- 468,474 ----
frameworks had been registered. */


void
! darwin_register_frameworks (const char *sysroot,
const char *iprefix ATTRIBUTE_UNUSED, int stdinc)
{
if (stdinc)
*************** darwin_register_frameworks (const char *
*** 478,485 ****
/* Setup default search path for frameworks. */
for (i=0; i<sizeof (framework_defaults)/sizeof(const char *); ++i)
{
/* System Framework headers are cxx aware. */
! add_system_framework_path (xstrdup (framework_defaults[i]));
}
}


--- 478,490 ----
/* Setup default search path for frameworks. */
for (i=0; i<sizeof (framework_defaults)/sizeof(const char *); ++i)
{
+ char *str;
+ if (sysroot)
+ str = concat (sysroot, xstrdup (framework_defaults [i]), NULL);
+ else
+ str = xstrdup (framework_defaults[i]);
/* System Framework headers are cxx aware. */
! add_system_framework_path (str);
}
}


Index: gcc/testsuite/gcc.dg/cpp/isysroot-1.c
===================================================================
RCS file: gcc/testsuite/gcc.dg/cpp/isysroot-1.c
diff -N gcc/testsuite/gcc.dg/cpp/isysroot-1.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- gcc/testsuite/gcc.dg/cpp/isysroot-1.c 22 Nov 2004 22:03:32 -0000
***************
*** 0 ****
--- 1,10 ----
+ /* { dg-options "-isysroot ${srcdir}/gcc.dg/cpp" } */
+ /* { dg-do compile } */
+
+ #include <stdio.h>
+ int main()
+ {
+ /* Special stdio.h supplies function foo. */
+ foo();
+ return 0;
+ }
Index: gcc/testsuite/gcc.dg/cpp/isysroot-2.c
===================================================================
RCS file: gcc/testsuite/gcc.dg/cpp/isysroot-2.c
diff -N gcc/testsuite/gcc.dg/cpp/isysroot-2.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- gcc/testsuite/gcc.dg/cpp/isysroot-2.c 22 Nov 2004 22:03:32 -0000
***************
*** 0 ****
--- 1,10 ----
+ /* { dg-options "-isysroot ${srcdir}/gcc.dg/cpp" { target *-*-darwin* } } */
+ /* { dg-do compile } */
+
+ #include <Carbon/Carbon.h>
+ int main()
+ {
+ /* Special Carbon.h supplies function foo. */
+ foo();
+ return 0;
+ }
Index: gcc/testsuite/gcc.dg/cpp/System/Library/Frameworks/Carbon.framework/ Headers/Carbon.h
===================================================================
RCS file: gcc/testsuite/gcc.dg/cpp/System/Library/Frameworks/Carbon.framework/ Headers/Carbon.h
diff -N gcc/testsuite/gcc.dg/cpp/System/Library/Frameworks/Carbon.framework/ Headers/Carbon.h
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- gcc/testsuite/gcc.dg/cpp/System/Library/Frameworks/Carbon.framework/ Headers/Carbon.h 22 Nov 2004 22:03:32 -0000
***************
*** 0 ****
--- 1,4 ----
+ /* Used by gcc.dg/cpp/isysroot-2.c to test isysroot. */
+ void foo()
+ {
+ }
Index: gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h
===================================================================
RCS file: gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h
diff -N gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- gcc/testsuite/gcc.dg/cpp/usr/include/stdio.h 22 Nov 2004 22:03:32 -0000
***************
*** 0 ****
--- 1,4 ----
+ /* Used by gcc.dg/cpp/isysroot-1.c to test isysroot. */
+ void foo()
+ {
+ }



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