Permalink
Browse files

Some GCC versions disallow #pragma inside function body.

  • Loading branch information...
1 parent 4c4243a commit b823672dd3a8dddbe0dcf9cf351b9d45a5158eb7 @jimis jimis committed Jul 18, 2014
Showing with 8 additions and 5 deletions.
  1. +8 −5 libcompat/snprintf.c
View
@@ -1658,7 +1658,15 @@ int rpl_printf(const char *format, ...)
int main(void);
#endif /* !HAVE_SNPRINTF || !HAVE_VSNPRINTF || !HAVE_ASPRINTF || [...] */
+
#if TEST_SNPRINTF
+
+/* sprintf() is marked as deprecated in CFEngine, but here we use it on
+ * purpose to compare this snprintf() implementation to the system's
+ * implementation. So avoid emitting the warning. */
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
+
static int snprintf_rigorous_test(void)
{
const char *float_fmt[] = {
@@ -2167,11 +2175,6 @@ do { \
} \
} while (/* CONSTCOND */ 0)
-/* sprintf() is marked as deprecated in CFEngine, but here we use it on
- * purpose to compare this snprintf() implementation to the system's
- * implementation. So avoid emitting the warning. */
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
#if HAVE_LOCALE_H
(void)setlocale(LC_ALL, "");
#endif /* HAVE_LOCALE_H */

0 comments on commit b823672

Please sign in to comment.