diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-03-22 14:06:04 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-03-22 14:06:04 -0400 |
commit | c643e1dd27e633c67589b622a06582bbb6fb5cf6 (patch) | |
tree | 63b66d28f4121f077d464b8b5f426004cfe153fc | |
parent | 43fbffc232679ddd286f7c527755d15872c73d01 (diff) | |
download | bfs-c643e1dd27e633c67589b622a06582bbb6fb5cf6.tar.xz |
Fix some -Wpedantic warnings
-rw-r--r-- | src/config.h | 6 | ||||
-rw-r--r-- | src/opt.c | 12 |
2 files changed, 8 insertions, 10 deletions
diff --git a/src/config.h b/src/config.h index 45422a2..892f24c 100644 --- a/src/config.h +++ b/src/config.h @@ -192,9 +192,7 @@ typedef long double max_align_t; /** * Silence warnings about switch/case fall-throughs. */ -#if __has_c_attribute(fallthrough) -# define fallthru [[fallthrough]] -#elif __has_attribute(fallthrough) +#if __has_attribute(fallthrough) # define fallthru __attribute__((fallthrough)) #else # define fallthru ((void)0) @@ -309,7 +307,7 @@ typedef long double max_align_t; * attr_d */ #define attr(...) \ - attr__(attr_##__VA_ARGS__, none, none, none, none, none, none, none, none, none) + attr__(attr_##__VA_ARGS__, none, none, none, none, none, none, none, none, none, ) /** * attr() helper. For exposition, pretend we support only 2 args, instead of 9. @@ -724,7 +724,7 @@ struct visitor { visit_fn *leave; /** A visitor lookup table. */ - struct visitor_table table[]; + const struct visitor_table *table; }; /** Recursive visitor implementation. */ @@ -1331,7 +1331,7 @@ static struct bfs_expr *annotate_visit(struct bfs_opt *opt, struct bfs_expr *exp static const struct visitor annotate = { .name = "annotate", .visit = annotate_visit, - .table = { + .table = (const struct visitor_table[]) { {eval_access, annotate_access}, {eval_empty, annotate_empty}, {eval_exec, annotate_exec}, @@ -1516,7 +1516,7 @@ static struct bfs_expr *canonicalize_assoc(struct bfs_opt *opt, struct bfs_expr */ static const struct visitor canonicalize = { .name = "canonicalize", - .table = { + .table = (const struct visitor_table[]) { {eval_not, canonicalize_not}, {eval_and, canonicalize_assoc}, {eval_or, canonicalize_assoc}, @@ -1609,7 +1609,7 @@ static struct bfs_expr *reorder_andor(struct bfs_opt *opt, struct bfs_expr *expr */ static const struct visitor reorder = { .name = "reorder", - .table = { + .table = (const struct visitor_table[]) { {eval_and, reorder_andor}, {eval_or, reorder_andor}, {NULL, NULL}, @@ -1887,7 +1887,7 @@ static const struct visitor data_flow = { .enter = data_flow_enter, .visit = data_flow_visit, .leave = data_flow_leave, - .table = { + .table = (const struct visitor_table[]) { {eval_access, data_flow_access}, {eval_gid, data_flow_gid}, {eval_inum, data_flow_inum}, @@ -2103,7 +2103,7 @@ static struct bfs_expr *simplify_comma(struct bfs_opt *opt, struct bfs_expr *exp */ static const struct visitor simplify = { .name = "simplify", - .table = { + .table = (const struct visitor_table[]) { {eval_not, simplify_not}, {eval_and, simplify_and}, {eval_or, simplify_or}, |