aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-17 21:41:05 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-17 22:58:22 +0200
commit98fa204a2da0fb34320544a90e886466a102ac4a (patch)
tree28ec562a0763cb465cf8891a7bed75318330f25c
parentb8fad4bcd02210912de8cbdefcd77e9ca743a575 (diff)
downloadsparse-98fa204a2da0fb34320544a90e886466a102ac4a.tar.gz
attribute: sort the table of modifier names
It easier to search an item if sorted and this avoid needless conflict when new items are always added at the end of the table. So, sort the table but keep the storage modifers first so that show_typename() & friends still display types as usual. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--show-parse.c26
-rw-r--r--validation/cond_expr2.c2
-rw-r--r--validation/function-redecl.c6
3 files changed, 17 insertions, 17 deletions
diff --git a/show-parse.c b/show-parse.c
index 8a145b88..0c4b9ec2 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -119,28 +119,28 @@ const char *modifier_string(unsigned long mod)
static struct mod_name mod_names[] = {
{MOD_AUTO, "auto"},
+ {MOD_EXTERN, "extern"},
{MOD_REGISTER, "register"},
{MOD_STATIC, "static"},
- {MOD_EXTERN, "extern"},
+ {MOD_INLINE, "inline"},
{MOD_CONST, "const"},
- {MOD_VOLATILE, "volatile"},
{MOD_RESTRICT, "restrict"},
- {MOD_ATOMIC, "[atomic]"},
- {MOD_SIGNED, "[signed]"},
- {MOD_UNSIGNED, "[unsigned]"},
- {MOD_TLS, "[tls]"},
- {MOD_INLINE, "inline"},
+ {MOD_VOLATILE, "volatile"},
{MOD_ADDRESSABLE, "[addressable]"},
+ {MOD_ASSIGNED, "[assigned]"},
+ {MOD_ATOMIC, "[atomic]"},
+ {MOD_BITWISE, "[bitwise]"},
+ {MOD_EXPLICITLY_SIGNED, "[explicitly-signed]"},
{MOD_NOCAST, "[nocast]"},
{MOD_NODEREF, "[noderef]"},
- {MOD_TOPLEVEL, "[toplevel]"},
- {MOD_ASSIGNED, "[assigned]"},
- {MOD_SAFE, "[safe]"},
- {MOD_USERTYPE, "[usertype]"},
{MOD_NORETURN, "[noreturn]"},
- {MOD_EXPLICITLY_SIGNED, "[explicitly-signed]"},
- {MOD_BITWISE, "[bitwise]"},
{MOD_PURE, "[pure]"},
+ {MOD_SAFE, "[safe]"},
+ {MOD_SIGNED, "[signed]"},
+ {MOD_TLS, "[tls]"},
+ {MOD_TOPLEVEL, "[toplevel]"},
+ {MOD_UNSIGNED, "[unsigned]"},
+ {MOD_USERTYPE, "[usertype]"},
};
for (i = 0; i < ARRAY_SIZE(mod_names); i++) {
diff --git a/validation/cond_expr2.c b/validation/cond_expr2.c
index 5e974cfa..a5d96576 100644
--- a/validation/cond_expr2.c
+++ b/validation/cond_expr2.c
@@ -16,7 +16,7 @@ cond_expr2.c:6:11: warning: incorrect type in assignment (different modifiers)
cond_expr2.c:6:11: expected void volatile *extern [addressable] [toplevel] q
cond_expr2.c:6:11: got void const volatile *
cond_expr2.c:8:11: warning: incorrect type in assignment (different modifiers)
-cond_expr2.c:8:11: expected int volatile *extern [addressable] [toplevel] [assigned] r
+cond_expr2.c:8:11: expected int volatile *extern [addressable] [assigned] [toplevel] r
cond_expr2.c:8:11: got int const volatile *
* check-error-end
*/
diff --git a/validation/function-redecl.c b/validation/function-redecl.c
index 03151359..d0d844a5 100644
--- a/validation/function-redecl.c
+++ b/validation/function-redecl.c
@@ -51,11 +51,11 @@ void arg_vararg(int a, ...) { } /* check-should-fail */
function-redecl.c:5:6: error: symbol 'ret_type' redeclared with different type (different base types):
function-redecl.c:5:6: void extern [addressable] [toplevel] ret_type( ... )
function-redecl.c:4:5: note: previously declared as:
-function-redecl.c:4:5: int extern [signed] [addressable] [toplevel] ret_type( ... )
+function-redecl.c:4:5: int extern [addressable] [signed] [toplevel] ret_type( ... )
function-redecl.c:9:11: error: symbol 'ret_const' redeclared with different type (different modifiers):
-function-redecl.c:9:11: int extern const [signed] [addressable] [toplevel] ret_const( ... )
+function-redecl.c:9:11: int extern const [addressable] [signed] [toplevel] ret_const( ... )
function-redecl.c:8:5: note: previously declared as:
-function-redecl.c:8:5: int extern [signed] [addressable] [toplevel] ret_const( ... )
+function-redecl.c:8:5: int extern [addressable] [signed] [toplevel] ret_const( ... )
function-redecl.c:13:13: error: symbol 'ret_as' redeclared with different type (different address spaces):
function-redecl.c:13:13: void <asn:1> *extern [addressable] [toplevel] ret_as( ... )
function-redecl.c:12:6: note: previously declared as: