diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-11-09 12:59:20 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-11-09 15:35:05 -0500 |
commit | 026e8fbd248561396752552efa3cc04e0ac832b7 (patch) | |
tree | f1923d669e629be299c99a9563a2090613d48a5b | |
parent | b5b1e98a66aef5b64409e3d02149733bf3f475fb (diff) | |
download | bfs-026e8fbd248561396752552efa3cc04e0ac832b7.tar.xz |
config: s/BFS_FORMATTER/attr_format/
-rw-r--r-- | src/bar.c | 2 | ||||
-rw-r--r-- | src/color.c | 4 | ||||
-rw-r--r-- | src/color.h | 4 | ||||
-rw-r--r-- | src/config.h | 4 | ||||
-rw-r--r-- | src/diag.h | 14 | ||||
-rw-r--r-- | src/dstring.h | 8 | ||||
-rw-r--r-- | src/eval.c | 2 | ||||
-rw-r--r-- | src/exec.c | 2 | ||||
-rw-r--r-- | src/opt.c | 4 | ||||
-rw-r--r-- | src/parse.c | 14 |
10 files changed, 29 insertions, 29 deletions
@@ -127,7 +127,7 @@ static void reset_before_death_by(int sig) { } /** printf() to the status bar with a single write(). */ -BFS_FORMATTER(2, 3) +attr_format(2, 3) static int bfs_bar_printf(struct bfs_bar *bar, const char *format, ...) { va_list args; va_start(args, format); diff --git a/src/color.c b/src/color.c index fbb5edf..7644ca3 100644 --- a/src/color.c +++ b/src/color.c @@ -1105,7 +1105,7 @@ static int print_link_target(CFILE *cfile, const struct BFTW *ftwbuf) { } /** Format some colored output to the buffer. */ -BFS_FORMATTER(2, 3) +attr_format(2, 3) static int cbuff(CFILE *cfile, const char *format, ...); /** Dump a parsed expression tree, for debugging. */ @@ -1177,7 +1177,7 @@ static int print_expr(CFILE *cfile, const struct bfs_expr *expr, bool verbose) { return 0; } -BFS_FORMATTER(2, 0) +attr_format(2, 0) static int cvbuff(CFILE *cfile, const char *format, va_list args) { const struct colors *colors = cfile->colors; int error = errno; diff --git a/src/color.h b/src/color.h index b118f77..8a81573 100644 --- a/src/color.h +++ b/src/color.h @@ -100,13 +100,13 @@ int cfclose(CFILE *cfile); * @return * 0 on success, -1 on failure. */ -BFS_FORMATTER(2, 3) +attr_format(2, 3) int cfprintf(CFILE *cfile, const char *format, ...); /** * cfprintf() variant that takes a va_list. */ -BFS_FORMATTER(2, 0) +attr_format(2, 0) int cvfprintf(CFILE *cfile, const char *format, va_list args); #endif // BFS_COLOR_H diff --git a/src/config.h b/src/config.h index e11941a..f19677c 100644 --- a/src/config.h +++ b/src/config.h @@ -188,9 +188,9 @@ * Adds compiler warnings for bad printf()-style function calls, if supported. */ #if __has_attribute(format) -# define BFS_FORMATTER(fmt, args) __attribute__((format(printf, fmt, args))) +# define attr_format(fmt, args) __attribute__((format(printf, fmt, args))) #else -# define BFS_FORMATTER(fmt, args) +# define attr_format(fmt, args) #endif /** @@ -44,7 +44,7 @@ struct bfs_loc { /** * Print a message to standard error and abort. */ -BFS_FORMATTER(2, 3) +attr_format(2, 3) noreturn void bfs_abortf(const struct bfs_loc *loc, const char *format, ...); /** @@ -121,7 +121,7 @@ void bfs_perror(const struct bfs_ctx *ctx, const char *str); /** * Shorthand for printing error messages. */ -BFS_FORMATTER(2, 3) +attr_format(2, 3) void bfs_error(const struct bfs_ctx *ctx, const char *format, ...); /** @@ -129,7 +129,7 @@ void bfs_error(const struct bfs_ctx *ctx, const char *format, ...); * * @return Whether a warning was printed. */ -BFS_FORMATTER(2, 3) +attr_format(2, 3) bool bfs_warning(const struct bfs_ctx *ctx, const char *format, ...); /** @@ -137,25 +137,25 @@ bool bfs_warning(const struct bfs_ctx *ctx, const char *format, ...); * * @return Whether a debug message was printed. */ -BFS_FORMATTER(3, 4) +attr_format(3, 4) bool bfs_debug(const struct bfs_ctx *ctx, enum debug_flags flag, const char *format, ...); /** * bfs_error() variant that takes a va_list. */ -BFS_FORMATTER(2, 0) +attr_format(2, 0) void bfs_verror(const struct bfs_ctx *ctx, const char *format, va_list args); /** * bfs_warning() variant that takes a va_list. */ -BFS_FORMATTER(2, 0) +attr_format(2, 0) bool bfs_vwarning(const struct bfs_ctx *ctx, const char *format, va_list args); /** * bfs_debug() variant that takes a va_list. */ -BFS_FORMATTER(3, 0) +attr_format(3, 0) bool bfs_vdebug(const struct bfs_ctx *ctx, enum debug_flags flag, const char *format, va_list args); /** diff --git a/src/dstring.h b/src/dstring.h index 6496a4f..fd98df8 100644 --- a/src/dstring.h +++ b/src/dstring.h @@ -230,7 +230,7 @@ int dstrxcpy(dchar **dest, const char *str, size_t len); * @return * The created string, or NULL on failure. */ -BFS_FORMATTER(1, 2) +attr_format(1, 2) char *dstrprintf(const char *format, ...); /** @@ -243,7 +243,7 @@ char *dstrprintf(const char *format, ...); * @return * The created string, or NULL on failure. */ -BFS_FORMATTER(1, 0) +attr_format(1, 0) char *dstrvprintf(const char *format, va_list args); /** @@ -258,7 +258,7 @@ char *dstrvprintf(const char *format, va_list args); * @return * 0 on success, -1 on failure. */ -BFS_FORMATTER(2, 3) +attr_format(2, 3) int dstrcatf(dchar **str, const char *format, ...); /** @@ -273,7 +273,7 @@ int dstrcatf(dchar **str, const char *format, ...); * @return * 0 on success, -1 on failure. */ -BFS_FORMATTER(2, 0) +attr_format(2, 0) int dstrvcatf(dchar **str, const char *format, va_list args); /** @@ -58,7 +58,7 @@ struct bfs_eval { /** * Print an error message. */ -BFS_FORMATTER(2, 3) +attr_format(2, 3) static void eval_error(struct bfs_eval *state, const char *format, ...) { // By POSIX, any errors should be accompanied by a non-zero exit status *state->ret = EXIT_FAILURE; @@ -22,7 +22,7 @@ #include <unistd.h> /** Print some debugging info. */ -BFS_FORMATTER(2, 3) +attr_format(2, 3) static void bfs_exec_debug(const struct bfs_exec *execbuf, const char *format, ...) { const struct bfs_ctx *ctx = execbuf->ctx; @@ -305,7 +305,7 @@ struct opt_state { }; /** Log an optimization. */ -BFS_FORMATTER(3, 4) +attr_format(3, 4) static bool opt_debug(const struct opt_state *state, int level, const char *format, ...) { bfs_assert(state->ctx->optlevel >= level); @@ -321,7 +321,7 @@ static bool opt_debug(const struct opt_state *state, int level, const char *form } /** Warn about an expression. */ -BFS_FORMATTER(3, 4) +attr_format(3, 4) static void opt_warning(const struct opt_state *state, const struct bfs_expr *expr, const char *format, ...) { if (bfs_expr_warning(state->ctx, expr)) { va_list args; diff --git a/src/parse.c b/src/parse.c index d21ab40..d3938fc 100644 --- a/src/parse.c +++ b/src/parse.c @@ -247,7 +247,7 @@ static void highlight_args(const struct bfs_ctx *ctx, char **argv, size_t argc, /** * Print an error message during parsing. */ -BFS_FORMATTER(2, 3) +attr_format(2, 3) static void parse_error(const struct parser_state *state, const char *format, ...) { int error = errno; const struct bfs_ctx *ctx = state->ctx; @@ -267,7 +267,7 @@ static void parse_error(const struct parser_state *state, const char *format, .. /** * Print an error about some command line arguments. */ -BFS_FORMATTER(4, 5) +attr_format(4, 5) static void parse_argv_error(const struct parser_state *state, char **argv, size_t argc, const char *format, ...) { int error = errno; const struct bfs_ctx *ctx = state->ctx; @@ -287,7 +287,7 @@ static void parse_argv_error(const struct parser_state *state, char **argv, size /** * Print an error about conflicting command line arguments. */ -BFS_FORMATTER(6, 7) +attr_format(6, 7) static void parse_conflict_error(const struct parser_state *state, char **argv1, size_t argc1, char **argv2, size_t argc2, const char *format, ...) { int error = errno; const struct bfs_ctx *ctx = state->ctx; @@ -308,7 +308,7 @@ static void parse_conflict_error(const struct parser_state *state, char **argv1, /** * Print an error about an expression. */ -BFS_FORMATTER(3, 4) +attr_format(3, 4) static void parse_expr_error(const struct parser_state *state, const struct bfs_expr *expr, const char *format, ...) { int error = errno; const struct bfs_ctx *ctx = state->ctx; @@ -325,7 +325,7 @@ static void parse_expr_error(const struct parser_state *state, const struct bfs_ /** * Print a warning message during parsing. */ -BFS_FORMATTER(2, 3) +attr_format(2, 3) static bool parse_warning(const struct parser_state *state, const char *format, ...) { int error = errno; const struct bfs_ctx *ctx = state->ctx; @@ -348,7 +348,7 @@ static bool parse_warning(const struct parser_state *state, const char *format, /** * Print a warning about conflicting command line arguments. */ -BFS_FORMATTER(6, 7) +attr_format(6, 7) static bool parse_conflict_warning(const struct parser_state *state, char **argv1, size_t argc1, char **argv2, size_t argc2, const char *format, ...) { int error = errno; const struct bfs_ctx *ctx = state->ctx; @@ -372,7 +372,7 @@ static bool parse_conflict_warning(const struct parser_state *state, char **argv /** * Print a warning about an expression. */ -BFS_FORMATTER(3, 4) +attr_format(3, 4) static bool parse_expr_warning(const struct parser_state *state, const struct bfs_expr *expr, const char *format, ...) { int error = errno; const struct bfs_ctx *ctx = state->ctx; |