With ancient gcc, skip pg_attribute_printf() on function pointer.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 19 Mar 2016 14:59:20 +0000 (10:59 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 19 Mar 2016 14:59:20 +0000 (10:59 -0400)
Buildfarm results show that the ability to attach pg_attribute_printf
decoration to a function pointer appeared somewhere between gcc 2.95.3
and gcc 4.0.1.  Guess that it was there in 4.0.

src/bin/psql/psqlscan.h

index d515ce34f2361bf5b2984ca8b80ede316b838d21..4ff321866fccd48e4447b769a1a26596f60ab489 100644 (file)
@@ -32,7 +32,12 @@ typedef struct PsqlScanCallbacks
    /* This pointer can be NULL if no variable substitution is wanted */
    char       *(*get_variable) (const char *varname, bool escape, bool as_ident);
    /* Print an error message someplace appropriate */
+   /* (very old gcc versions don't support attributes on function pointers) */
+#if defined(__GNUC__) && __GNUC__ < 4
+   void        (*write_error) (const char *fmt,...);
+#else
    void        (*write_error) (const char *fmt,...) pg_attribute_printf(1, 2);
+#endif
 } PsqlScanCallbacks;