This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] dtrace: accept "char const" via pyparsing


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]