summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.h15
-rw-r--r--src/printf.c18
2 files changed, 14 insertions, 19 deletions
diff --git a/src/config.h b/src/config.h
index 38ca69b..e11941a 100644
--- a/src/config.h
+++ b/src/config.h
@@ -202,19 +202,4 @@
# endif
#endif
-/**
- * Ignore a particular GCC warning for a region of code.
- */
-#if __GNUC__
-# define BFS_PRAGMA_STRINGIFY(...) _Pragma(#__VA_ARGS__)
-# define BFS_SUPPRESS(warning) \
- _Pragma("GCC diagnostic push"); \
- BFS_PRAGMA_STRINGIFY(GCC diagnostic ignored warning)
-# define BFS_UNSUPPRESS() \
- _Pragma("GCC diagnostic pop")
-#else
-# define BFS_SUPPRESS(warning)
-# define BFS_UNSUPPRESS()
-#endif
-
#endif // BFS_CONFIG_H
diff --git a/src/printf.c b/src/printf.c
index 704e26d..02ca586 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -83,9 +83,14 @@ static int dyn_fprintf(FILE *file, const struct bfs_printf *directive, ...) {
va_list args;
va_start(args, directive);
- BFS_SUPPRESS("-Wformat-nonliteral");
+#if __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
int ret = vfprintf(file, directive->str, args);
- BFS_UNSUPPRESS();
+#if __GNUC__
+# pragma GCC diagnostic pop
+#endif
va_end(args);
return ret;
@@ -183,9 +188,14 @@ static int bfs_printf_strftime(CFILE *cfile, const struct bfs_printf *directive,
// POSIX strftime() features
default:
format[1] = directive->c;
- BFS_SUPPRESS("-Wformat-nonliteral");
+#if __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
ret = strftime(buf, sizeof(buf), format, &tm);
- BFS_UNSUPPRESS();
+#if __GNUC__
+# pragma GCC diagnostic pop
+#endif
break;
}