diff --git a/cgen/__init__.py b/cgen/__init__.py index 2cf92f9d3210daca298b679fd1491d534d54df8e..05df50292e37e276c44a1ceb0d1038bcd7b3ae2e 100644 --- a/cgen/__init__.py +++ b/cgen/__init__.py @@ -240,6 +240,14 @@ class Const(NestedDeclarator): mapper_method = "map_const" +class Volatile(NestedDeclarator): + def get_decl_pair(self): + sub_tp, sub_decl = self.subdecl.get_decl_pair() + return sub_tp, ("volatile %s" % sub_decl) + + mapper_method = "map_volatile" + + class Extern(DeclSpecifier): def __init__(self, language, subdecl): self.language = language diff --git a/cgen/mapper.py b/cgen/mapper.py index b171d5ad6765ddaad7cab3ac6d9c9d7c95189d90..5bc71a11413d3319fc711677d6bf0bb83e2aead8 100644 --- a/cgen/mapper.py +++ b/cgen/mapper.py @@ -76,6 +76,7 @@ class IdentityMapper(ASTMapper): map_static = map_typedef map_const = map_typedef + map_volatile = map_typedef def map_extern(self, node, *args, **kwargs): return type(node)(node.language, self.rec(node.subdecl, *args, **kwargs))