Open brmmm3 opened 7 years ago
Sure, I'd be happy to take a (tested) patch.
(That is to say, a patch that includes tests.)
I would if I would have enough experience to implement this. My current result ist:
def p_asm_register_declarator(self, p):
""" declaration : declaration_specifiers declarator __ASM__ LPAREN argument_expression_list RPAREN
"""
storage = p[1]["storage"]
if not storage or (storage[0] != "register"):
raise NotImplementedError(
"register expected here '%s'"
% list(p))
decl = c_ast.TypeDecl(
declname=p[1],
type=None,
quals=None,
coord=self._token_coord(p, 2))
spec = p[1]
ty = spec['type']
c_ast.Decl(
name=None,
quals=spec['qual'],
storage=spec['storage'],
funcspec=spec['function'],
type=ty[0],
init=None,
bitsize=None,
coord=ty[0].coord)
p[0] = self._type_modify_decl(decl, p[2])
But it seems to be wrong because when I convert it back to C-Code then no C-Code is created for this line. I hoped that you as the maintainer have enough experience to quickly implement it.
Best regards, Martin
You need to add the code to the C generator: https://github.com/inducer/pycparserext/blob/master/pycparserext/ext_c_generator.py
Is it possible to add support for the following syntax:
register typeName variableName asm("registerName");
Best regards, Martin