From 1d8b75550fcd072f7692c3a50debde6ad9a77bce Mon Sep 17 00:00:00 2001 From: John Bowler Date: Thu, 3 Nov 2011 18:19:53 -0500 Subject: [PATCH] [libpng15] Fix for the preprocessor of the Intel C compiler. The preprocessor adjacent @ signs with a space; this changes the concatentation from @@@ to PNG_JOIN; that should work with all compiler preprocessors. --- ANNOUNCE | 4 ++++ CHANGES | 4 ++++ Makefile.am | 4 ++-- Makefile.in | 4 ++-- scripts/def.dfn | 4 ++-- scripts/options.awk | 11 ++++++----- scripts/sym.dfn | 2 +- scripts/vers.dfn | 4 ++-- 8 files changed, 23 insertions(+), 14 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 31e1cbb4e..4c4108ae3 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -33,6 +33,10 @@ Version 1.5.7 [November 3, 2011] of a png_struct or png_info failed. This would probably have led to a crash. The pngmem.c implementation of png_malloc() included a cast to png_size_t which would fail on large allocations on 16-bit systems. + Fix for the preprocessor of the Intel C compiler. The preprocessor + splits adjacent @ signs with a space; this changes the concatentation + token from @@@ to PNG_JOIN; that should work with all compiler + preprocessors. Send comments/corrections/commendations to png-mng-implement at lists.sf.net: (subscription required; visit diff --git a/CHANGES b/CHANGES index cc2ebea58..07bc57408 100644 --- a/CHANGES +++ b/CHANGES @@ -3676,6 +3676,10 @@ Version 1.5.7 [November 3, 2011] of a png_struct or png_info failed. This would probably have led to a crash. The pngmem.c implementation of png_malloc() included a cast to png_size_t which would fail on large allocations on 16-bit systems. + Fix for the preprocessor of the Intel C compiler. The preprocessor + splits adjacent @ signs with a space; this changes the concatentation + token from @@@ to PNG_JOIN; that should work with all compiler + preprocessors. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/Makefile.am b/Makefile.am index b5b0789e8..ab92aa783 100644 --- a/Makefile.am +++ b/Makefile.am @@ -142,9 +142,9 @@ SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\ echo '#include "$<"' >dfn.c $(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\ $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out - $(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\ + $(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\ dfn1.out >dfn2.out - $(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out + $(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out rm -f dfn.c dfn[12].out mv dfn3.out $@ diff --git a/Makefile.in b/Makefile.in index 093b87917..993d89618 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1340,9 +1340,9 @@ pngvalid.o pngtest.o: pnglibconf.h echo '#include "$<"' >dfn.c $(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\ $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out - $(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p'\ + $(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\ dfn1.out >dfn2.out - $(SED) -e 's| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out + $(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out rm -f dfn.c dfn[12].out mv dfn3.out $@ diff --git a/scripts/def.dfn b/scripts/def.dfn index d918d4c3c..5fd752593 100644 --- a/scripts/def.dfn +++ b/scripts/def.dfn @@ -27,12 +27,12 @@ S--E S-EXPORTS-E S-;Version 1.5.0beta58-E -/* NOTE: @@@ is interpreted by the calling script as a signal to +/* NOTE: PNG_JOIN is interpreted by the calling script as a signal to * join the two things on either side, so we can do symbol * substitution within the name, regular C ## joins the pp-tokens, * not their final values. */ #define PNG_EXPORTA(ordinal, type, name, args, attributes)\ - PNG_DEFN_MAGIC- SYMBOL_PREFIX @@@ name-PNG_DEFN_END + PNG_DEFN_MAGIC- SYMBOL_PREFIX PNG_JOIN name-PNG_DEFN_END #include "../png.h" diff --git a/scripts/options.awk b/scripts/options.awk index 24f07137f..a30d668a3 100755 --- a/scripts/options.awk +++ b/scripts/options.awk @@ -35,13 +35,14 @@ BEGIN{ err=0 # in-line exit sets this start="PNG_DEFN_MAGIC-" # Arbitrary start end="-PNG_DEFN_END" # Arbitrary end - cx= "/@@@*" # Open C comment for output file + ct="PNG_JOIN" # Join two tokens + cx= "/" ct "*" # Open C comment for output file comment=start cx # Comment start cend="*/" end # Comment end - def=start "#define PNG_@@@" # Arbitrary define - sup="@@@_SUPPORTED" end # end supported option - und=comment "#undef PNG_@@@" # Unsupported option - une="@@@_SUPPORTED" cend # end unsupported option + def=start "#define PNG_" ct # Arbitrary define + sup=ct "_SUPPORTED" end # end supported option + und=comment "#undef PNG_" ct # Unsupported option + une=ct "_SUPPORTED" cend # end unsupported option error=start "ERROR:" # error message # Variables diff --git a/scripts/sym.dfn b/scripts/sym.dfn index 4b12ec2bf..f4f13df08 100644 --- a/scripts/sym.dfn +++ b/scripts/sym.dfn @@ -10,6 +10,6 @@ */ #define PNG_EXPORTA(ordinal, type, name, args, attributes)\ - PNG_DEFN_MAGIC-SYMBOL_PREFIX @@@ name-PNG_DEFN_END + PNG_DEFN_MAGIC-SYMBOL_PREFIX PNG_JOIN name-PNG_DEFN_END #include "../png.h" diff --git a/scripts/vers.dfn b/scripts/vers.dfn index a4bf5c720..89d5f3879 100644 --- a/scripts/vers.dfn +++ b/scripts/vers.dfn @@ -11,13 +11,13 @@ #define HEADER PNG_DEFN_MAGIC-PNGLIB_LIBNAME {global:-PNG_DEFN_END -/* NOTE: @@@ is interpreted by the calling script as a signal to +/* NOTE: PNG_JOIN is interpreted by the calling script as a signal to * join the two things on either side, so we can do symbol * substitution within the name, regular C ## joins the pp-tokens, * not their final values. */ #define PNG_EXPORTA(ordinal, type, name, args, attributes)\ - PNG_DEFN_MAGIC- SYMBOL_PREFIX @@@ name;-PNG_DEFN_END + PNG_DEFN_MAGIC- SYMBOL_PREFIX PNG_JOIN name;-PNG_DEFN_END #define TRAILER PNG_DEFN_MAGIC-local: *; };-PNG_DEFN_END