[09/17] Regex: Add undefs of various routines and macros.

Message ID 201712080916.vB89GxOG005507@skeeve.com
State New, archived
Headers

Commit Message

Arnold Robbins Dec. 8, 2017, 9:16 a.m. UTC
  This patch adds undefs for various routines and macros, making the
code more consistent.

2017-11-27         Arnold D. Robbins     <arnold@skeeve.com>

	* posix/regex_internal.h: Add undefs of various routines / macros.
  

Comments

Florian Weimer Dec. 8, 2017, 9:33 a.m. UTC | #1
On 12/08/2017 10:16 AM, Arnold Robbins wrote:
> +# ifdef inline
> +# undef inline
> +# endif
> +# define inline

Indentation is off.  This also applies to the other patch hunk.

These macro manipulations could break system headers, and it seems that 
at least <stdint.h> is included after them, so maybe the include order 
needs changing.

Thanks,
Florian
  
Arnold Robbins Dec. 8, 2017, 9:48 a.m. UTC | #2
Florian Weimer <fweimer@redhat.com> wrote:

> On 12/08/2017 10:16 AM, Arnold Robbins wrote:
> > +# ifdef inline
> > +# undef inline
> > +# endif
> > +# define inline
>
> Indentation is off.  This also applies to the other patch hunk.
>
> These macro manipulations could break system headers, and it seems that 
> at least <stdint.h> is included after them, so maybe the include order 
> needs changing.
>
> Thanks,
> Florian

This is the kind of thing I'll ask the GLIBC maintainers to handle
if / when they integrate. 

Thanks,

Arnold
  
Andreas Schwab Dec. 8, 2017, 12:33 p.m. UTC | #3
On Dez 08 2017, Arnold Robbins <arnold@skeeve.com> wrote:

> @@ -97,6 +97,10 @@
>  # define BE(expr, val) __builtin_expect (expr, val)
>  #else
>  # define BE(expr, val) (expr)
> +# ifdef inline
> +# undef inline
> +# endif

It's not an error to undef an undefined macro.

Andreas.
  
Arnold Robbins Dec. 8, 2017, 12:49 p.m. UTC | #4
Andreas Schwab <schwab@linux-m68k.org> wrote:

> On Dez 08 2017, Arnold Robbins <arnold@skeeve.com> wrote:
>
> > @@ -97,6 +97,10 @@
> >  # define BE(expr, val) __builtin_expect (expr, val)
> >  #else
> >  # define BE(expr, val) (expr)
> > +# ifdef inline
> > +# undef inline
> > +# endif
>
> It's not an error to undef an undefined macro.
>
> Andreas.
>
> -- 
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."

Heaven only knows how long I've had that bit.  But all you're saying
is that the change could be reduced from 3 lines to 1. A minor improvement
to which I have no objection.

THanks,

Arnold
  

Patch

diff --git a/posix/regex_internal.h b/posix/regex_internal.h
index e9cc2b6..e07a44a 100644
--- a/posix/regex_internal.h
+++ b/posix/regex_internal.h
@@ -97,6 +97,10 @@ 
 # define BE(expr, val) __builtin_expect (expr, val)
 #else
 # define BE(expr, val) (expr)
+# ifdef inline
+# undef inline
+# endif
+# define inline
 #endif
 
 /* Number of single byte character.  */
@@ -110,10 +114,17 @@ 
 
 /* Rename to standard API for using out of glibc.  */
 #ifndef _LIBC
+# ifdef __wctype
+# undef __wctype
+# endif
 # define __wctype wctype
+# ifdef __iswctype
+# undef __iswctype
+# endif
 # define __iswctype iswctype
 # define __btowc btowc
 # define __mbrtowc mbrtowc
+#undef __mempcpy
 # define __mempcpy mempcpy
 # define __wcrtomb wcrtomb
 # define __regfree regfree