aboutsummaryrefslogtreecommitdiff
path: root/attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'attr.c')
-rw-r--r--attr.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/attr.c b/attr.c
index 75ec5ef..8b06d46 100644
--- a/attr.c
+++ b/attr.c
@@ -88,3 +88,29 @@ attr(struct attr *a, enum attrkind allowed)
;
return true;
}
+
+static bool
+gnuattrspec(struct attr *a, enum attrkind allowed)
+{
+ if (!consume(T__ATTRIBUTE__))
+ return false;
+ while (parseattr(a, allowed, PREFIXGNU) || consume(TCOMMA))
+ ;
+ expect(TLPAREN, "after '__attribute__' to begin attribute specifier");
+ expect(TLPAREN, "after '__attribute__' to begin attribute specifier");
+ while (parseattr(a, allowed, PREFIXGNU) || consume(TCOMMA))
+ ;
+ expect(TRPAREN, "to end attribute specifier");
+ expect(TRPAREN, "to end attribute specifier");
+ return true;
+}
+
+bool
+gnuattr(struct attr *a, enum attrkind allowed)
+{
+ if (!gnuattrspec(a, allowed))
+ return false;
+ while (gnuattrspec(a, allowed))
+ ;
+ return true;
+}