diff options
| author | David Lamparter <equinox@diac24.net> | 2021-02-19 00:05:35 +0100 | 
|---|---|---|
| committer | David Lamparter <equinox@diac24.net> | 2021-03-26 17:51:55 +0100 | 
| commit | bcf9d7d8aa77c66ac2e99f75ae11e276accecb1d (patch) | |
| tree | b416dc23bc80d7af831cff730b5afa4a76d0caff /tools/gcc-plugins | |
| parent | 23922bbc0821270ad09bcffdf7c16b2fb4984d6e (diff) | |
tools/gcc-plugin: support [un]signed in pragma
Need `unsigned char *` for `%pHX`.
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'tools/gcc-plugins')
| -rw-r--r-- | tools/gcc-plugins/frr-format.c | 17 | ||||
| -rw-r--r-- | tools/gcc-plugins/frr-format.h | 2 | 
2 files changed, 17 insertions, 2 deletions
diff --git a/tools/gcc-plugins/frr-format.c b/tools/gcc-plugins/frr-format.c index efb2c6393c..e9f397f225 100644 --- a/tools/gcc-plugins/frr-format.c +++ b/tools/gcc-plugins/frr-format.c @@ -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);      } diff --git a/tools/gcc-plugins/frr-format.h b/tools/gcc-plugins/frr-format.h index 87d2049ed4..599dbc56f9 100644 --- a/tools/gcc-plugins/frr-format.h +++ b/tools/gcc-plugins/frr-format.h @@ -113,6 +113,8 @@ struct kernel_ext_fmt  	tree_code type_code;  	int ptrlevel;  	bool t_const; +	bool t_unsigned; +	bool t_signed;  	bool warned;  	const char *type_str;  | 
