diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-11-09 15:29:04 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-11-09 15:35:03 -0500 |
commit | b5b1e98a66aef5b64409e3d02149733bf3f475fb (patch) | |
tree | 552d32ceeca5adee2569dc0c0e86c85de26b0383 /src | |
parent | ffa465b759204272a5e94d851ce3696c827e9d96 (diff) | |
download | bfs-b5b1e98a66aef5b64409e3d02149733bf3f475fb.tar.xz |
config: Remove BFS_SUPPRESS()
Diffstat (limited to 'src')
-rw-r--r-- | src/config.h | 15 | ||||
-rw-r--r-- | src/printf.c | 18 |
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; } |