Commit bca22160 authored by Jon Turney's avatar Jon Turney Committed by Adam Jackson

xfree86: work around a sdksyms problem with gcc5 on Cygwin

The linemarkers in the preprocessor output from gcc5 on Cygwin have
canonicalized paths to included files (e.g. xserver/build/../include/misc.h
is canonicalized to xserver/build/include/misc.h). (see gcc svn rev 210264,
which causes the transformation performed by -fcanonical-system-headers to
be applied to all include pathnames)

These canonicalized paths won't match $topdir, so sdksyms doesn't look at
the contents of those headers for sdk exported symbols.

Workaround this by canonicalizing all the paths we consider, using readlink.

v2:
Keep a cache of readlink results so it isn't quite so dreadfully slow.
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
parent ac15d4ce
......@@ -296,7 +296,7 @@ cat > sdksyms.c << EOF
EOF
topdir=$1
topdir=$(readlink -f $1)
shift
LC_ALL=C
export LC_ALL
......@@ -314,11 +314,24 @@ BEGIN {
printf("sdksyms.c:") > "sdksyms.dep";
}
/^# [0-9]+ "/ {
# Process text after a include in a relative path or when the
# processed file has a basename matching $top_srcdir.
# Note that indexing starts at 1; 0 means no match, and there
# is a starting ".
sdk = $3 !~ /^"\// || index($3, topdir) == 2;
# Match preprocessor linemarkers which have the form:
# # linenum "filename" flags
#
# Only process text for sdk exports where the linemarker filename has a
# relative path, or an absolute path matching $top_srcdir.
#
# canonicalize filename
if ($3 in canonicalized) {
c = canonicalized[$3]
} else {
cmd = "readlink -f " $3
cmd | getline c
close(cmd)
canonicalized[$3] = c
}
# note that index() starts at 1; 0 means no match.
sdk = $3 !~ /^"\// || index(c, topdir) == 1;
if (sdk && $3 ~ /\.h"$/) {
# remove quotes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment