[PATCH] Massage cpp output before passing to awk for generating sdksyms.c

Alan Coopersmith alan.coopersmith at oracle.com
Wed Feb 11 08:04:45 PST 2015


Fixes build errors when using Solaris Studio 12.4 from getting the wrong
strings (such as __attribute__) put into the sdksyms function list.

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 hw/xfree86/Makefile.am |    3 ++-
 hw/xfree86/sdksyms.sh  |    7 ++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 27f2cc6..a600a75 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -135,7 +135,8 @@ CLEANFILES = sdksyms.c sdksyms.dep Xorg.sh
 EXTRA_DIST += sdksyms.sh
 
 sdksyms.dep sdksyms.c: sdksyms.sh
-	$(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS)
+	$(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' SED='$(SED)' $(SHELL) \
+	 $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS)
 
 SDKSYMS_DEP = sdksyms.dep
 -include $(SDKSYMS_DEP)
diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh
index 2305073..3b9363a 100755
--- a/hw/xfree86/sdksyms.sh
+++ b/hw/xfree86/sdksyms.sh
@@ -314,7 +314,12 @@ shift
 LC_ALL=C
 export LC_ALL
 ${CPP:-cpp} "$@" sdksyms.c > /dev/null || exit $?
-${CPP:-cpp} "$@" sdksyms.c | ${AWK:-awk} -v topdir=$topdir '
+# Some cpps add spaces in the middle of __attribute__((visibility(...)))
+# so we need to remove them for the following awk script to work.
+${CPP:-cpp} "$@" sdksyms.c | \
+    ${SED:-sed} -e 's/( /(/g' -e 's/_ (/_(/g' -e 's/ )/)/g' \
+    -e 's/visibility (/visibility(/' | \
+    ${AWK:-awk} -v topdir=$topdir '
 BEGIN {
     sdk = 0;
     print("/*");
-- 
1.7.9.2



More information about the xorg-devel mailing list