[RFC,mig,7/12] Drop -undef -ansi from cpp flags

Message ID 20230212111044.610942-8-bugaevc@gmail.com
State Not applicable, archived
Headers
Series Towards glibc on x86_64-gnu |

Checks

Context Check Description
dj/TryBot-apply_patch fail Patch failed to apply to master at the time it was sent

Commit Message

Sergey Bugaev Feb. 12, 2023, 11:10 a.m. UTC
  Since GNU Mach commit d30481122a5d24ad6b921062f93b9172ef922fc3,
i386/machine_types.defs defines types based on defined(__x86_64__).
Supressing the built-in macro definitions will now result in the wrong
type being silently selected.

-undef was initially introduced in commit
78b6a7665db7b2eae367e17102821cbdca231d19 without much of an explanation.
-ansi was introduced in commit 6940fb91859e46b2e96a331a029f2dc2a0ee51c9
"to avoid -Di386=1 and the like".

Since glibc has been using MIG with CPP set to a custom GCC invocation
which did *not* use either flag, it appears that everything works well
enough even without them. On the other hand, not having __x86_64__
defined most definetely causes issues for anything that does not set a
custom CPP when invoking MIG (i.e., most users). Other built-in
definitions could be used in the future in a similar way (e.g. on other
architectures); it's really more of a coincidence that they have not
been used until now, and things kept working with -undef.
---
 mig.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Samuel Thibault Feb. 12, 2023, 3:01 p.m. UTC | #1
Sergey Bugaev, le dim. 12 févr. 2023 14:10:38 +0300, a ecrit:
> Since GNU Mach commit d30481122a5d24ad6b921062f93b9172ef922fc3,
> i386/machine_types.defs defines types based on defined(__x86_64__).
> Supressing the built-in macro definitions will now result in the wrong
> type being silently selected.
> 
> -undef was initially introduced in commit
> 78b6a7665db7b2eae367e17102821cbdca231d19 without much of an explanation.
> -ansi was introduced in commit 6940fb91859e46b2e96a331a029f2dc2a0ee51c9
> "to avoid -Di386=1 and the like".
> 
> Since glibc has been using MIG with CPP set to a custom GCC invocation
> which did *not* use either flag, it appears that everything works well
> enough even without them. On the other hand, not having __x86_64__
> defined most definetely causes issues for anything that does not set a
> custom CPP when invoking MIG (i.e., most users). Other built-in
> definitions could be used in the future in a similar way (e.g. on other
> architectures); it's really more of a coincidence that they have not
> been used until now, and things kept working with -undef.

That looks alright to me. Flavior, what do you think about it?

> ---
>  mig.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mig.in b/mig.in
> index 63e0269..94fd500 100644
> --- a/mig.in
> +++ b/mig.in
> @@ -38,7 +38,7 @@ migcom=${MIGDIR-$libexecdir}/${MIGCOM-@MIGCOM@}
>  # The expansion of TARGET_CC might refer to ${CC}, so make sure it is defined.
>  default_cc="@CC@"
>  CC="${CC-${default_cc}}"
> -default_cpp="@TARGET_CC@ -E -x c -undef -ansi"
> +default_cpp="@TARGET_CC@ -E -x c"
>  cpp="${CPP-${default_cpp}}"
>  
>  cppflags=
> -- 
> 2.39.1
  
Flavio Cruz Feb. 12, 2023, 6:43 p.m. UTC | #2
On Sun, Feb 12, 2023 at 10:02 AM Samuel Thibault <samuel.thibault@gnu.org>
wrote:

> Sergey Bugaev, le dim. 12 févr. 2023 14:10:38 +0300, a ecrit:
> > Since GNU Mach commit d30481122a5d24ad6b921062f93b9172ef922fc3,
> > i386/machine_types.defs defines types based on defined(__x86_64__).
> > Supressing the built-in macro definitions will now result in the wrong
> > type being silently selected.
> >
> > -undef was initially introduced in commit
> > 78b6a7665db7b2eae367e17102821cbdca231d19 without much of an explanation.
> > -ansi was introduced in commit 6940fb91859e46b2e96a331a029f2dc2a0ee51c9
> > "to avoid -Di386=1 and the like".
> >
> > Since glibc has been using MIG with CPP set to a custom GCC invocation
> > which did *not* use either flag, it appears that everything works well
> > enough even without them. On the other hand, not having __x86_64__
> > defined most definetely causes issues for anything that does not set a
> > custom CPP when invoking MIG (i.e., most users). Other built-in
> > definitions could be used in the future in a similar way (e.g. on other
> > architectures); it's really more of a coincidence that they have not
> > been used until now, and things kept working with -undef.
>
> That looks alright to me. Flavior, what do you think about it?
>

Seems fine to me.


>
> > ---
> >  mig.in | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/mig.in b/mig.in
> > index 63e0269..94fd500 100644
> > --- a/mig.in
> > +++ b/mig.in
> > @@ -38,7 +38,7 @@ migcom=${MIGDIR-$libexecdir}/${MIGCOM-@MIGCOM@}
> >  # The expansion of TARGET_CC might refer to ${CC}, so make sure it is
> defined.
> >  default_cc="@CC@"
> >  CC="${CC-${default_cc}}"
> > -default_cpp="@TARGET_CC@ -E -x c -undef -ansi"
> > +default_cpp="@TARGET_CC@ -E -x c"
> >  cpp="${CPP-${default_cpp}}"
> >
> >  cppflags=
> > --
> > 2.39.1
>
  
Samuel Thibault Feb. 12, 2023, 6:44 p.m. UTC | #3
Applied, thanks!

Sergey Bugaev, le dim. 12 févr. 2023 14:10:38 +0300, a ecrit:
> Since GNU Mach commit d30481122a5d24ad6b921062f93b9172ef922fc3,
> i386/machine_types.defs defines types based on defined(__x86_64__).
> Supressing the built-in macro definitions will now result in the wrong
> type being silently selected.
> 
> -undef was initially introduced in commit
> 78b6a7665db7b2eae367e17102821cbdca231d19 without much of an explanation.
> -ansi was introduced in commit 6940fb91859e46b2e96a331a029f2dc2a0ee51c9
> "to avoid -Di386=1 and the like".
> 
> Since glibc has been using MIG with CPP set to a custom GCC invocation
> which did *not* use either flag, it appears that everything works well
> enough even without them. On the other hand, not having __x86_64__
> defined most definetely causes issues for anything that does not set a
> custom CPP when invoking MIG (i.e., most users). Other built-in
> definitions could be used in the future in a similar way (e.g. on other
> architectures); it's really more of a coincidence that they have not
> been used until now, and things kept working with -undef.
> ---
>  mig.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mig.in b/mig.in
> index 63e0269..94fd500 100644
> --- a/mig.in
> +++ b/mig.in
> @@ -38,7 +38,7 @@ migcom=${MIGDIR-$libexecdir}/${MIGCOM-@MIGCOM@}
>  # The expansion of TARGET_CC might refer to ${CC}, so make sure it is defined.
>  default_cc="@CC@"
>  CC="${CC-${default_cc}}"
> -default_cpp="@TARGET_CC@ -E -x c -undef -ansi"
> +default_cpp="@TARGET_CC@ -E -x c"
>  cpp="${CPP-${default_cpp}}"
>  
>  cppflags=
> -- 
> 2.39.1
> 
>
  

Patch

diff --git a/mig.in b/mig.in
index 63e0269..94fd500 100644
--- a/mig.in
+++ b/mig.in
@@ -38,7 +38,7 @@  migcom=${MIGDIR-$libexecdir}/${MIGCOM-@MIGCOM@}
 # The expansion of TARGET_CC might refer to ${CC}, so make sure it is defined.
 default_cc="@CC@"
 CC="${CC-${default_cc}}"
-default_cpp="@TARGET_CC@ -E -x c -undef -ansi"
+default_cpp="@TARGET_CC@ -E -x c"
 cpp="${CPP-${default_cpp}}"
 
 cppflags=