Revision
80063
Author
jeremyhu@macports.org
Date
2011-07-03 10:25:49 -0700 (Sun, 03 Jul 2011)

Log Message

gperf: Fix generated code for compilation with C99 compilers like clang

Modified Paths

Added Paths

Diff

Modified: trunk/dports/devel/gperf/Portfile (80062 => 80063)


--- trunk/dports/devel/gperf/Portfile	2011-07-03 17:02:46 UTC (rev 80062)
+++ trunk/dports/devel/gperf/Portfile	2011-07-03 17:25:49 UTC (rev 80063)
@@ -18,6 +18,8 @@
 
 configure.args		--infodir=${prefix}/share/info
 
+patchfiles              c99.patch
+
 test.run		yes
 test.target		check
 

Added: trunk/dports/devel/gperf/files/c99.patch (0 => 80063)


--- trunk/dports/devel/gperf/files/c99.patch	                        (rev 0)
+++ trunk/dports/devel/gperf/files/c99.patch	2011-07-03 17:25:49 UTC (rev 80063)
@@ -0,0 +1,39 @@
+--- src/output.cc.orig	2011-07-03 10:13:13.000000000 -0700
++++ src/output.cc	2011-07-03 10:17:43.000000000 -0700
+@@ -745,12 +745,12 @@ Output::output_hash_function () const
+   if (option[CPLUSPLUS])
+     printf ("inline ");
+   else if (option[KRC] | option[C] | option[ANSIC])
+-    printf ("#ifdef __GNUC__\n"
++    printf ("#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC_STDC_INLINE__)\n"
++            "static inline\n"
++            "#elif defined(__GNUC__)\n"
+             "__inline\n"
+-            "#else\n"
+-            "#ifdef __cplusplus\n"
++            "#elif defined(__cplusplus)\n"
+             "inline\n"
+-            "#endif\n"
+             "#endif\n");
+ 
+   if (/* The function does not use the 'str' argument?  */
+@@ -1892,12 +1892,13 @@ Output::output_lookup_function () const
+          warning: C99 inline functions are not supported; using GNU89
+          warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
+        It defines a macro __GNUC_GNU_INLINE__ to indicate this situation.  */
+-    printf ("#ifdef __GNUC__\n"
+-            "__inline\n"
+-            "#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__\n"
+-            "__attribute__ ((__gnu_inline__))\n"
+-            "#endif\n"
+-            "#endif\n");
++   printf ("#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC_STDC_INLINE__)\n"
++           "static inline\n"
++           "#elif defined(__GNUC__)\n"
++           "__inline\n"
++           "#elif defined(__cplusplus)\n"
++           "inline\n"
++           "#endif\n");
+ 
+   printf ("%s%s\n",
+           const_for_struct, _return_type);