Created attachment 33031 [details] patch to existing fixincludes/inclhack.def from gcc-4.7.3 Due to an update to sys/feature_tests.h as indicated here (https://illumos.org/issues/2941), Illumos has "broken" the fixincludes solaris___restrict hack as is evident by the current result in $PREFIX/gcc47/lib/.../include-fixed/sys/feature_tests.h /* * The following macro defines a value for the ISO C99 restrict * keyword so that _RESTRICT_KYWD resolves to "restrict" if * an ISO C99 compiler is used and "" (null string) if any other * compiler is used. This allows for the use of single prototype * declarations regardless of compiler version. */ #if (defined(__STDC__) && defined(_STDC_C99)) && !defined(__cplusplus) #ifdef __cplusplus #define _RESTRICT_KYWD __restrict #else #define _RESTRICT_KYWD restrict #endif #else #define _RESTRICT_KYWD #endif The attached patch seem to work around this by allowing both the standard and the Illumos forms to be updated. The test/base/sys/feature_tests.h patch is as follows: --- fixincludes/tests/base/sys/feature_tests.h.orig 2010-06-21 15:27:29.000000000 +0000 +++ fixincludes/tests/base/sys/feature_tests.h @@ -10,6 +10,7 @@ #if defined( SOLARIS___RESTRICT_CHECK ) +#if (defined(__STDC__) && defined(_STDC_C99)) #ifdef __cplusplus #define _RESTRICT_KYWD __restrict #else
given https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52168, it seems necessary to update the test_text line with a newline appended as follows so that check.sh doesn't balk: >+ test_text = "#if (defined(__STDC__) && defined(_STDC_C99))\n" >+ "#define _RESTRICT_KYWD restrict";
(In reply to Richard PALO from comment #0) > > The test/base/sys/feature_tests.h patch is as follows: > --- fixincludes/tests/base/sys/feature_tests.h.orig 2010-06-21 > 15:27:29.000000000 +0000 > +++ fixincludes/tests/base/sys/feature_tests.h > @@ -10,6 +10,7 @@ > > > #if defined( SOLARIS___RESTRICT_CHECK ) > +#if (defined(__STDC__) && defined(_STDC_C99)) > #ifdef __cplusplus > #define _RESTRICT_KYWD __restrict > #else Shouldn't there be a corresponding #endif added to that file?
No. Prior to fixincludes, sys/feature_tests.h in SunOS looks like the following: #if (defined(__STDC__) && defined(_STDC_C99)) #define _RESTRICT_KYWD restrict #else #define _RESTRICT_KYWD #endif Illumos has since https://www.illumos.org/issues/2941 the following: #if (defined(__STDC__) && defined(_STDC_C99)) && !defined(__cplusplus) #define _RESTRICT_KYWD restrict #else #define _RESTRICT_KYWD #endif The net effect of my patch is to support both variants in producing the following: #if (defined(__STDC__) && defined(_STDC_C99)) #ifdef __cplusplus #define _RESTRICT_KYWD __restrict #else #define _RESTRICT_KYWD restrict #endif #else #define _RESTRICT_KYWD #endif
> > The test/base/sys/feature_tests.h patch is as follows: > --- fixincludes/tests/base/sys/feature_tests.h.orig 2010-06-21 > 15:27:29.000000000 +0000 > +++ fixincludes/tests/base/sys/feature_tests.h > @@ -10,6 +10,7 @@ > > > #if defined( SOLARIS___RESTRICT_CHECK ) > +#if (defined(__STDC__) && defined(_STDC_C99)) > #ifdef __cplusplus > #define _RESTRICT_KYWD __restrict > #else Perhaps I should remind as well that the file is a diff with only a certain number of lines as context... so in that respect, it isn't necessary either.
kind reminder to push these two patches: 1) https://gcc.gnu.org/bugzilla/attachment.cgi?id=33031 2) and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61649#c1 (*) * NB https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52168 I believe I already answered Jonathan's question in that since only a [preceeding] line of context is being added, there is no additional '#endif' to add. BTW, this line of context is necessary anyway, because if either Oracle Solaris or Illumos change this code section, for example by fixing it as gcc currently does here, it will prevent fixincl.x from action which would actually *break* the file.