source: trunk/dports/devel/gperf/files/c99.patch @ 80063

Last change on this file since 80063 was 80063, checked in by jeremyhu@…, 8 years ago

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

File size: 1.6 KB
  • src/output.cc

    old new Output::output_hash_function () const 
    745745  if (option[CPLUSPLUS])
    746746    printf ("inline ");
    747747  else if (option[KRC] | option[C] | option[ANSIC])
    748     printf ("#ifdef __GNUC__\n"
     748    printf ("#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC_STDC_INLINE__)\n"
     749            "static inline\n"
     750            "#elif defined(__GNUC__)\n"
    749751            "__inline\n"
    750             "#else\n"
    751             "#ifdef __cplusplus\n"
     752            "#elif defined(__cplusplus)\n"
    752753            "inline\n"
    753             "#endif\n"
    754754            "#endif\n");
    755755
    756756  if (/* The function does not use the 'str' argument?  */
    Output::output_lookup_function () const 
    18921892         warning: C99 inline functions are not supported; using GNU89
    18931893         warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
    18941894       It defines a macro __GNUC_GNU_INLINE__ to indicate this situation.  */
    1895     printf ("#ifdef __GNUC__\n"
    1896             "__inline\n"
    1897             "#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__\n"
    1898             "__attribute__ ((__gnu_inline__))\n"
    1899             "#endif\n"
    1900             "#endif\n");
     1895   printf ("#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC_STDC_INLINE__)\n"
     1896           "static inline\n"
     1897           "#elif defined(__GNUC__)\n"
     1898           "__inline\n"
     1899           "#elif defined(__cplusplus)\n"
     1900           "inline\n"
     1901           "#endif\n");
    19011902
    19021903  printf ("%s%s\n",
    19031904          const_for_struct, _return_type);
Note: See TracBrowser for help on using the repository browser.