public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] dtrace: accept "char const" via pyparsing
@ 2018-02-01 16:17 Stefan Hajnoczi
  2018-02-01 16:25 ` Frank Ch. Eigler
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2018-02-01 16:17 UTC (permalink / raw)
  To: systemtap; +Cc: Frank Ch . Eigler, Stan Cox, Stefan Hajnoczi

The widely used "const char" declaration specifier can also be written
as "char const".  While this form is rarely used, currently produces the
following warning from dtrace(1):

  Warning: /usr/bin/dtrace:myapp.dtrace:66: syntax error near:
  probe probe1

  Warning: Proceeding as if --no-pyparsing was given.

This patch extends the pyparsing grammar to accept "char const" as
defined by ISO/IEC 9899:1999 ("C99").  Now "const char", "char const",
and even "const char const" are accepted without a noisy warning.

Note that "const char const" is also valid C and described by the
standard:

  6.7.3 Type qualifiers
  4  If the same qualifier appears more than once in the same
     specifier-qualifier-list, either directly or via one or more
     typedefs, the behavior is the same as if it appeared only once.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 dtrace.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dtrace.in b/dtrace.in
index 25efc253b..a6d407eab 100644
--- a/dtrace.in
+++ b/dtrace.in
@@ -134,7 +134,7 @@ class _PypProvider(_HeaderCreator):
         varname_spec = varname + Optional("[" + array_size + "]")
         struct_decl = Group(oneOf("struct union") + varname + Suppress(nestedExpr('{','}')) + semi)
         enum_decl = Group("enum" + varname + Suppress(nestedExpr('{','}')) + semi)
-        member_decl = Group((Optional(oneOf("struct unsigned const")) + type_name)
+        member_decl = Group((Optional(oneOf("struct unsigned const")) + type_name + Optional(Keyword("const")))
                             + Optional(Word("*"), default="") + Optional(varname_spec))
         struct_typedef = Group(Literal("typedef") + Literal("struct") + varname
                                + Suppress(nestedExpr('{','}'))) + Optional(varname) + semi
-- 
2.14.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dtrace: accept "char const" via pyparsing
  2018-02-01 16:17 [PATCH] dtrace: accept "char const" via pyparsing Stefan Hajnoczi
@ 2018-02-01 16:25 ` Frank Ch. Eigler
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Ch. Eigler @ 2018-02-01 16:25 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: systemtap, Stan Cox

Hi -

> The widely used "const char" declaration specifier can also be written
> as "char const".  While this form is rarely used, currently produces the
> following warning from dtrace(1): [...]
> This patch extends the pyparsing grammar [...]

Thanks, merged!

- FChE

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-01 16:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 16:17 [PATCH] dtrace: accept "char const" via pyparsing Stefan Hajnoczi
2018-02-01 16:25 ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).