Patchwork Poison loc_t in system.h

login
register
mail settings
Submitter David Edelsohn
Date Nov. 1, 2012, 7:54 p.m.
Message ID <CAGWvnykGgy+cbG25Ekk+VUOMMER3PtvpAgA4A=vUNY9cvdqX2w@mail.gmail.com>
Download mbox | patch
Permalink /patch/196372/
State New
Headers show

Comments

David Edelsohn - Nov. 1, 2012, 7:54 p.m.
The name loc_t is too enticing for developers to avoid, but it
unfortunately conflicts with a visible symbol in an AIX header file,
which repeatedly causes conflicts.  This patch poisons the symbols in
GCC system.h to prevent developers from using it.

Bootstrapped on powerpc-ibm-aix7.1.0.0

Okay?

Thanks, David

        * system.h (loc_t): Poison.
Richard Guenther - Nov. 4, 2012, 4:57 p.m.
On Thu, Nov 1, 2012 at 8:54 PM, David Edelsohn <dje.gcc@gmail.com> wrote:
> The name loc_t is too enticing for developers to avoid, but it
> unfortunately conflicts with a visible symbol in an AIX header file,
> which repeatedly causes conflicts.  This patch poisons the symbols in
> GCC system.h to prevent developers from using it.
>
> Bootstrapped on powerpc-ibm-aix7.1.0.0
>
> Okay?

Ok.

Thanks,
Richard.

> Thanks, David
>
>         * system.h (loc_t): Poison.
>
> Index: system.h
> ===================================================================
> --- system.h    (revision 193045)
> +++ system.h    (working copy)
> @@ -774,6 +774,11 @@
>  #undef strerror
>   #pragma GCC poison strerror
>
> +/* loc_t is defined on some systems and too inviting for some
> +   programmers to avoid.  */
> +#undef loc_t
> + #pragma GCC poison loc_t
> +
>  /* Old target macros that have moved to the target hooks structure.  */
>   #pragma GCC poison ASM_OPEN_PAREN ASM_CLOSE_PAREN                     \
>         FUNCTION_PROLOGUE FUNCTION_EPILOGUE                             \

Patch

Index: system.h
===================================================================
--- system.h    (revision 193045)
+++ system.h    (working copy)
@@ -774,6 +774,11 @@ 
 #undef strerror
  #pragma GCC poison strerror

+/* loc_t is defined on some systems and too inviting for some
+   programmers to avoid.  */
+#undef loc_t
+ #pragma GCC poison loc_t
+
 /* Old target macros that have moved to the target hooks structure.  */
  #pragma GCC poison ASM_OPEN_PAREN ASM_CLOSE_PAREN                     \
        FUNCTION_PROLOGUE FUNCTION_EPILOGUE                             \