Bug 64864 - [5 Regression] preprocessor linemarkers break configure checks
Summary: [5 Regression] preprocessor linemarkers break configure checks
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-29 17:08 UTC by Markus Trippelsdorf
Modified: 2015-02-18 13:44 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Trippelsdorf 2015-01-29 17:08:44 UTC
For example (this happens for many projects that check for the boost version):
...
checking for working strtod... yes
checking for gettimeofday... yes
checking for Boost headers version >= 1.36.0... yes
checking for Boost's header version... 
configure: error: invalid value: boost_major_version=

markus@x4 core % cat test.cpp
#include <boost/version.hpp>                                                                                                                                                                                                                                                           
boost-lib-version = BOOST_LIB_VERSION
 
markus@x4 core % g++ -E test.cpp
# 1 "test.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "test.cpp"
# 1 "/usr/include/boost/version.hpp" 1 3 4
# 2 "test.cpp" 2
boost-lib-version = 
# 2 "test.cpp" 3 4
                   "1_56"

markus@x4 core % /usr/x86_64-pc-linux-gnu/gcc-bin/4.9.2/g++ -E test.cpp
# 1 "test.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 1 "<command-line>" 2
# 1 "test.cpp"
# 1 "/usr/include/boost/version.hpp" 1 3 4
# 2 "test.cpp" 2
boost-lib-version = "1_56"

I know that these linemarkers are valid. 
But is it really necessary that they appear in the middle of statements? 

Using -P is a workaround, that apparently nobody uses in configure scripts.
 
See also PR64604.
Comment 1 Jakub Jelinek 2015-01-29 17:18:01 UTC
But they should.
Though, it is true that it affects quite a lot of packages, e.g.
cclive emacs ember gnote ksh libcmis libgpg-error libixion liborcus ncurses openldap
to name a few.

As before, the change was introduced with PR60723.
Comment 2 Jakub Jelinek 2015-01-29 17:20:09 UTC
I really think this is porting_to.html material, rather than a bug report.
Comment 3 Markus Trippelsdorf 2015-01-29 17:27:55 UTC
(In reply to Jakub Jelinek from comment #2)
> I really think this is porting_to.html material, rather than a bug report.

I agree that the issue is borderline. Feel free to close this bug.

What is gained by these new linemarkers?
Comment 4 Jakub Jelinek 2015-01-29 17:36:26 UTC
The line markers allows the compiler to properly distinguish between what tokens come from where, e.g. system headers vs. normal headers (should we warn about issues in there if -Wsystem-headers is not used and it is some warning not enabled by default in system headers), or e.g. for #pragma GCC diagnostics tracking.
Comment 5 Marek Polacek 2015-01-29 17:39:26 UTC
More info here https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60723#c13

I'm going to prepare the porting_to bit, then I think we should close this bug.
Comment 6 dodji@seketeli.org 2015-01-30 09:12:13 UTC
"mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> a écrit:

> I'm going to prepare the porting_to bit

Thank you for doing that!

> then I think we should close this bug.

FWIW, I agree.
Comment 7 Markus Trippelsdorf 2015-02-08 20:14:34 UTC
The list of broken packages goes on and on.
xorg-server-1.17:

sdksyms.c:313:15: error: expected expression before ‘,’ token
     (void *) &,                                                  /* /var/tmp/portage/x11-base/xorg-server-1.17.0/work/xorg-server-1.17.0/include/os.h:92 */
               ^
Makefile:801: recipe for target 'sdksyms.o' failed

From sdksyms.sh: 
...
topdir=$1                                                                                                                                                                                                                                                                              
shift                                                                                                                                                                                                                                                                                  
LC_ALL=C                                                                                                                                                                                                                                                                               
export LC_ALL                                                                                                                                                                                                                                                                          
${CPP:-cpp} "$@" sdksyms.c > /dev/null || exit $?                                                                                                                                                                                                                                   
${CPP:-cpp} "$@" sdksyms.c | ${AWK:-awk} -v topdir=$topdir '                                                                                                                                                                                                                        
BEGIN {    
...
Comment 8 Markus Trippelsdorf 2015-02-18 13:44:29 UTC
porting_to was updated. Closing.