3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-27 13:12:42 +01:00

CGrammar: Add _Atomic

This commit is contained in:
Pragmatic Software 2014-07-07 09:15:46 +00:00
parent d244af52d8
commit 6295b0f503
3 changed files with 10 additions and 2 deletions

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 714,
BUILD_REVISION => 715,
BUILD_DATE => "2014-07-07",
};

View File

@ -19,7 +19,7 @@ if($code =~ s/^-f\s+//) {
}
my ($has_function, $has_main, $got_nomain);
my $prelude_base = "#define _XOPEN_SOURCE 9001\n#define __USE_XOPEN\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n#include <math.h>\n#include <limits.h>\n#include <sys/types.h>\n#include <stdint.h>\n#include <errno.h>\n#include <ctype.h>\n#include <assert.h>\n#include <stdnoreturn.h>\n#include <stdbool.h>\n#include <stdalign.h>\n#define _Static_assert(a, b)\n\n";
my $prelude_base = "#define _XOPEN_SOURCE 9001\n#define __USE_XOPEN\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n#include <math.h>\n#include <limits.h>\n#include <sys/types.h>\n#include <stdint.h>\n#include <errno.h>\n#include <ctype.h>\n#include <assert.h>\n#include <stdnoreturn.h>\n#include <stdbool.h>\n#include <stdalign.h>\n#define _Atomic\n#define _Static_assert(a, b)\n\n";
my $prelude = $prelude_base;
print "code before: [$code]\n" if $debug;

View File

@ -1605,6 +1605,13 @@ storage_class_specifier:
type_qualifier:
'const'
| 'volatile'
| 'restrict'
| '_Atomic'
{ $return = 'atomic'; }
atomic_type_specifier:
'_Atomic' '(' type_name ')'
{ $return = "atomic $item{type_name}"; }
type_specifier:
<skip:''> /\s*/ ('void' | 'double' | 'float' | 'char' | 'short' | 'int' | 'long'
@ -1630,6 +1637,7 @@ type_specifier:
| 'clock_t' | 'time_t'
| <skip:'[\s]*'> struct_or_union_specifier
| <skip:'[\s]*'> enum_specifier
| <skip:'[\s]*'> atomic_type_specifier
| typedef_name) .../\W/
{ $return = $item[3]; }