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