From 95ccddb1ffd1551c52cd517c9eb53d8ec10c37a4 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Fri, 16 Nov 2018 17:19:53 -0600 Subject: [PATCH] Implement volatile --- cgen/__init__.py | 8 ++++++++ cgen/mapper.py | 1 + 2 files changed, 9 insertions(+) diff --git a/cgen/__init__.py b/cgen/__init__.py index 2cf92f9..05df502 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 b171d5a..5bc71a1 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)) -- GitLab