summaryrefslogtreecommitdiff
path: root/tools/gcc-plugins/frr-format.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2021-03-31 09:10:30 -0400
committerGitHub <noreply@github.com>2021-03-31 09:10:30 -0400
commite2efe13327adefb655811bdb03bb76b95db2407c (patch)
treeb9fa898013c23be16c8a50ee477af017ab52220a /tools/gcc-plugins/frr-format.c
parentfb639375cb2ca062f350c56c51367f2d8d5b2514 (diff)
parent19b1a1c6a975f772b22dda9c5c42c6288e2ce459 (diff)
Merge pull request #8350 from opensourcerouting/printfrr-revamp
lib: `printfrr()` care package
Diffstat (limited to 'tools/gcc-plugins/frr-format.c')
-rw-r--r--tools/gcc-plugins/frr-format.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/gcc-plugins/frr-format.c b/tools/gcc-plugins/frr-format.c
index 6d91d2cdcd..e9f397f225 100644
--- a/tools/gcc-plugins/frr-format.c
+++ b/tools/gcc-plugins/frr-format.c
@@ -2343,7 +2343,7 @@ check_argument_type (const format_char_info *fci,
/* note printf extension type checks are *additional* - %p must always
* be pointer compatible, %d always int compatible.
*/
- if (!kef)
+ if (first_wanted_type->kind != CF_KIND_FORMAT || !kef)
return true;
const struct kernel_ext_fmt *kef_now;
@@ -4241,6 +4241,11 @@ handle_finish_parse (void *event_data, void *data)
continue;
}
node = TREE_TYPE (node);
+
+ if (etab->t_unsigned)
+ node = c_common_unsigned_type (node);
+ else if (etab->t_signed)
+ node = c_common_signed_type (node);
}
etab->type = node;
@@ -4357,9 +4362,17 @@ handle_pragma_printfrr_ext (cpp_reader *dummy)
ttype = pragma_lex (&token, &loc);
/* qualifiers */
- if (ttype == CPP_NAME && !strcmp (IDENTIFIER_POINTER (token), "const"))
+ while (ttype == CPP_NAME)
{
- etab->t_const = true;
+ if (!strcmp (IDENTIFIER_POINTER (token), "const"))
+ etab->t_const = true;
+ else if (!strcmp (IDENTIFIER_POINTER (token), "signed"))
+ etab->t_signed = true;
+ else if (!strcmp (IDENTIFIER_POINTER (token), "unsigned"))
+ etab->t_unsigned = true;
+ else
+ break;
+
ttype = pragma_lex (&token, &loc);
}