Skip to content

Commit

Permalink
fix: allow ms pointer modifiers in abstract pointer declarators
Browse files Browse the repository at this point in the history
  • Loading branch information
amaanq committed Feb 16, 2024
1 parent 8e6e28c commit 579f349
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ module.exports = grammar({
field('declarator', $._type_declarator),
))),
abstract_pointer_declarator: $ => prec.dynamic(1, prec.right(seq('*',
repeat($.ms_pointer_modifier),
repeat($.type_qualifier),
field('declarator', optional($._abstract_declarator)),
))),
Expand Down
22 changes: 22 additions & 0 deletions test/corpus/declarations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,9 @@ extern int strerror_r(int __errnum, char *__buf,
"__xpg_strerror_r")
__attribute__((__nothrow__)) __attribute__((__nonnull__(2)));

extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
__gnuc_va_list);

int f([[a::b(c), d]] int x) {}

[[gnu::always_inline]] [[gnu::hot]] [[gnu::const]] [[nodiscard]]
Expand Down Expand Up @@ -955,6 +958,25 @@ struct __attribute__((__packed__)) foo_t {
(identifier)
(argument_list
(number_literal)))))))
(declaration
(storage_class_specifier)
(primitive_type)
(function_declarator
(identifier)
(parameter_list
(parameter_declaration
(type_identifier)
(abstract_pointer_declarator
(ms_pointer_modifier
(ms_restrict_modifier))))
(parameter_declaration
(type_qualifier)
(primitive_type)
(abstract_pointer_declarator
(ms_pointer_modifier
(ms_restrict_modifier))))
(parameter_declaration
(type_identifier)))))
(function_definition
(primitive_type)
(function_declarator
Expand Down

0 comments on commit 579f349

Please sign in to comment.