From 9623086310060ce5736ab221dcd8a1cc2e0583b6 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Mon, 7 Jul 2014 06:45:50 +0000 Subject: [PATCH] CGrammar: Add C11's _Alignof --- PBot/VERSION.pm | 4 ++-- modules/c2english/CGrammar.pm | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/PBot/VERSION.pm b/PBot/VERSION.pm index d5928d37..2aed553d 100644 --- a/PBot/VERSION.pm +++ b/PBot/VERSION.pm @@ -13,8 +13,8 @@ use warnings; # These are set automatically by the build/commit script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 711, - BUILD_DATE => "2014-07-05", + BUILD_REVISION => 712, + BUILD_DATE => "2014-07-06", }; 1; diff --git a/modules/c2english/CGrammar.pm b/modules/c2english/CGrammar.pm index 6ac5c7fa..1a7d0302 100644 --- a/modules/c2english/CGrammar.pm +++ b/modules/c2english/CGrammar.pm @@ -973,6 +973,12 @@ unary_expression: { $return = "the size of the type of the expression ($item{assignment_expression})"; } | 'sizeof' unary_expression[context => 'sizeof'] { $return = "the size of $item{unary_expression}"; } + | Alignof '(' type_name ')' + { $return = "the alignment of the type $item{type_name}"; } + +Alignof: + '_Alignof' + | 'alignof' postfix_productions: '(' argument_expression_list(?) ')' postfix_productions[context => 'function call'](?) @@ -1824,6 +1830,6 @@ string: reserved: /(auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto |if|inline|int|long|register|restrict|return|short|signed|sizeof|static|struct|switch|typedef - |union|unsigned|void|volatile|while|_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic + |union|unsigned|void|volatile|while|_Alignas|alignas|_Alignof|alignof|_Atomic|_Bool|_Complex|_Generic |_Imaginary|_Noreturn|_Static_assert|_Thread_local)\b/x