bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AC_EGREP_CPP and AC_EGREP_HEADER users - beware of recent gcc


From: Bruno Haible
Subject: AC_EGREP_CPP and AC_EGREP_HEADER users - beware of recent gcc
Date: Wed, 15 Feb 2017 11:52:11 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-62-generic; KDE/5.18.0; x86_64; ; )

Hi all,

Some uses of AC_EGREP_CPP and AC_EGREP_HEADER probably assume that when
no continuation lines (backslash-newline) and no multiline macro invocations
are involved, each source line produces at most one output line.

This is no longer the case with GCC >= 5.

Example:
=============== foo.c ===============
#include <features.h>
#define FOO 2
#define FOO_VERSION 12

Version FOO . FOO_VERSION
Version __GLIBC__ . __GLIBC_MINOR__

#define show(a,b) Version a . b
show(FOO,FOO_VERSION)
show(__GLIBC__,__GLIBC_MINOR__)
=====================================

With gcc-4.9.4:
$ gcc -E foo.c
[...]

Version 2 . 12
Version 2 . 23


Version 2 . 12
Version 2 . 23

With gcc-5.1.0 and newer:
$ gcc -E foo.c
[...]

Version 2 . 12
Version 
# 6 "foo.c" 3 4
       2 
# 6 "foo.c"
                 . 
# 6 "foo.c" 3 4
                   23



# 9 "foo.c"
Version 2 . 12
Version 
# 10 "foo.c" 3 4
2 
# 10 "foo.c"
. 
# 10 "foo.c" 3 4
23


As you can see, here 1 source line produces up to 4 output lines (ignoring the
line number comment lines). Attempts to use 'grep Version' to find the values of
__GLIBC__ and __GLIBC_VERSION__ don't work any more.

Maybe the documentation of AC_EGREP_CPP and AC_EGREP_HEADER could include
a caveat about this?

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]