summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-11-22 09:33:49 -0500
committerTavian Barnes <tavianator@tavianator.com>2023-12-18 15:37:20 -0500
commita85fc263a89fb89bc8b2a8166747660a177b1773 (patch)
tree128645d8fb4bdfe0829420c132d8f319bc319a14
parent5b38f658ee42bef05cecb6cadec65b25d9e94993 (diff)
downloadbfs-a85fc263a89fb89bc8b2a8166747660a177b1773.tar.xz
config: s/attr_format/attr_printf/
-rw-r--r--src/bar.c2
-rw-r--r--src/color.c4
-rw-r--r--src/color.h4
-rw-r--r--src/config.h4
-rw-r--r--src/diag.h14
-rw-r--r--src/dstring.h8
-rw-r--r--src/eval.c2
-rw-r--r--src/exec.c2
-rw-r--r--src/opt.c4
-rw-r--r--src/parse.c14
10 files changed, 29 insertions, 29 deletions
diff --git a/src/bar.c b/src/bar.c
index babadc3..8ab4112 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -127,7 +127,7 @@ static void reset_before_death_by(int sig) {
}
/** printf() to the status bar with a single write(). */
-attr(format(2, 3))
+attr(printf(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 4c2c8ca..5247cbf 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. */
-attr(format(2, 3))
+attr(printf(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;
}
-attr(format(2, 0))
+attr(printf(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 81f0e2a..760aa9d 100644
--- a/src/color.h
+++ b/src/color.h
@@ -100,13 +100,13 @@ int cfclose(CFILE *cfile);
* @return
* 0 on success, -1 on failure.
*/
-attr(format(2, 3))
+attr(printf(2, 3))
int cfprintf(CFILE *cfile, const char *format, ...);
/**
* cfprintf() variant that takes a va_list.
*/
-attr(format(2, 0))
+attr(printf(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 aa03552..46f1efe 100644
--- a/src/config.h
+++ b/src/config.h
@@ -240,9 +240,9 @@ typedef long double max_align_t;
* Adds compiler warnings for bad printf()-style function calls, if supported.
*/
#if __has_attribute(format)
-# define attr_format(fmt, args) __attribute__((format(printf, fmt, args)))
+# define attr_printf(fmt, args) __attribute__((format(printf, fmt, args)))
#else
-# define attr_format(fmt, args)
+# define attr_printf(fmt, args)
#endif
/**
diff --git a/src/diag.h b/src/diag.h
index aa6a44f..791c065 100644
--- a/src/diag.h
+++ b/src/diag.h
@@ -44,7 +44,7 @@ struct bfs_loc {
/**
* Print a message to standard error and abort.
*/
-attr(cold, format(2, 3))
+attr(cold, printf(2, 3))
noreturn void bfs_abortf(const struct bfs_loc *loc, const char *format, ...);
/**
@@ -122,7 +122,7 @@ void bfs_perror(const struct bfs_ctx *ctx, const char *str);
/**
* Shorthand for printing error messages.
*/
-attr(cold, format(2, 3))
+attr(cold, printf(2, 3))
void bfs_error(const struct bfs_ctx *ctx, const char *format, ...);
/**
@@ -130,7 +130,7 @@ void bfs_error(const struct bfs_ctx *ctx, const char *format, ...);
*
* @return Whether a warning was printed.
*/
-attr(cold, format(2, 3))
+attr(cold, printf(2, 3))
bool bfs_warning(const struct bfs_ctx *ctx, const char *format, ...);
/**
@@ -138,25 +138,25 @@ bool bfs_warning(const struct bfs_ctx *ctx, const char *format, ...);
*
* @return Whether a debug message was printed.
*/
-attr(cold, format(3, 4))
+attr(cold, printf(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.
*/
-attr(cold, format(2, 0))
+attr(cold, printf(2, 0))
void bfs_verror(const struct bfs_ctx *ctx, const char *format, va_list args);
/**
* bfs_warning() variant that takes a va_list.
*/
-attr(cold, format(2, 0))
+attr(cold, printf(2, 0))
bool bfs_vwarning(const struct bfs_ctx *ctx, const char *format, va_list args);
/**
* bfs_debug() variant that takes a va_list.
*/
-attr(cold, format(3, 0))
+attr(cold, printf(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 1be1185..6006199 100644
--- a/src/dstring.h
+++ b/src/dstring.h
@@ -243,7 +243,7 @@ int dstrxcpy(dchar **dest, const char *str, size_t len);
* @return
* The created string, or NULL on failure.
*/
-attr(format(1, 2))
+attr(printf(1, 2))
char *dstrprintf(const char *format, ...);
/**
@@ -256,7 +256,7 @@ char *dstrprintf(const char *format, ...);
* @return
* The created string, or NULL on failure.
*/
-attr(format(1, 0))
+attr(printf(1, 0))
char *dstrvprintf(const char *format, va_list args);
/**
@@ -271,7 +271,7 @@ char *dstrvprintf(const char *format, va_list args);
* @return
* 0 on success, -1 on failure.
*/
-attr(format(2, 3))
+attr(printf(2, 3))
int dstrcatf(dchar **str, const char *format, ...);
/**
@@ -286,7 +286,7 @@ int dstrcatf(dchar **str, const char *format, ...);
* @return
* 0 on success, -1 on failure.
*/
-attr(format(2, 0))
+attr(printf(2, 0))
int dstrvcatf(dchar **str, const char *format, va_list args);
/**
diff --git a/src/eval.c b/src/eval.c
index 859ad7e..372fcf5 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -57,7 +57,7 @@ struct bfs_eval {
/**
* Print an error message.
*/
-attr(format(2, 3))
+attr(printf(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;
diff --git a/src/exec.c b/src/exec.c
index ba2fec8..60bfd28 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -22,7 +22,7 @@
#include <unistd.h>
/** Print some debugging info. */
-attr(format(2, 3))
+attr(printf(2, 3))
static void bfs_exec_debug(const struct bfs_exec *execbuf, const char *format, ...) {
const struct bfs_ctx *ctx = execbuf->ctx;
diff --git a/src/opt.c b/src/opt.c
index 3ee5e81..ddcd1ab 100644
--- a/src/opt.c
+++ b/src/opt.c
@@ -305,7 +305,7 @@ struct opt_state {
};
/** Log an optimization. */
-attr(format(3, 4))
+attr(printf(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. */
-attr(format(3, 4))
+attr(printf(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 35d22fb..8d9c3f0 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -246,7 +246,7 @@ static void highlight_args(const struct bfs_ctx *ctx, char **argv, size_t argc,
/**
* Print an error message during parsing.
*/
-attr(format(2, 3))
+attr(printf(2, 3))
static void parse_error(const struct parser_state *state, const char *format, ...) {
int error = errno;
const struct bfs_ctx *ctx = state->ctx;
@@ -266,7 +266,7 @@ static void parse_error(const struct parser_state *state, const char *format, ..
/**
* Print an error about some command line arguments.
*/
-attr(format(4, 5))
+attr(printf(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;
@@ -286,7 +286,7 @@ static void parse_argv_error(const struct parser_state *state, char **argv, size
/**
* Print an error about conflicting command line arguments.
*/
-attr(format(6, 7))
+attr(printf(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;
@@ -307,7 +307,7 @@ static void parse_conflict_error(const struct parser_state *state, char **argv1,
/**
* Print an error about an expression.
*/
-attr(format(3, 4))
+attr(printf(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;
@@ -324,7 +324,7 @@ static void parse_expr_error(const struct parser_state *state, const struct bfs_
/**
* Print a warning message during parsing.
*/
-attr(format(2, 3))
+attr(printf(2, 3))
static bool parse_warning(const struct parser_state *state, const char *format, ...) {
int error = errno;
const struct bfs_ctx *ctx = state->ctx;
@@ -347,7 +347,7 @@ static bool parse_warning(const struct parser_state *state, const char *format,
/**
* Print a warning about conflicting command line arguments.
*/
-attr(format(6, 7))
+attr(printf(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;
@@ -371,7 +371,7 @@ static bool parse_conflict_warning(const struct parser_state *state, char **argv
/**
* Print a warning about an expression.
*/
-attr(format(3, 4))
+attr(printf(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;