summaryrefslogtreecommitdiff
path: root/src/cmd/cc
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2013-08-29 12:36:59 -0700
committerKeith Randall <khr@golang.org>2013-08-29 12:36:59 -0700
commit99727813962faed41ef1ef8eaabe0fa41e48be58 (patch)
tree9896ac4580944564cea403984e2d78dbb9433217 /src/cmd/cc
parent8c0b259ac20f59b8375ca648bd3b99088d3fde69 (diff)
downloadgo-99727813962faed41ef1ef8eaabe0fa41e48be58.tar.gz
cmd/cc,runtime: change preprocessor to expand macros inside of
#pragma textflag and #pragma dataflag directives. Update dataflag directives to use symbols instead of integer constants. R=golang-dev, bradfitz CC=golang-dev https://codereview.appspot.com/13310043
Diffstat (limited to 'src/cmd/cc')
-rw-r--r--src/cmd/cc/dpchk.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/cmd/cc/dpchk.c b/src/cmd/cc/dpchk.c
index 34163ff92..606bf40dd 100644
--- a/src/cmd/cc/dpchk.c
+++ b/src/cmd/cc/dpchk.c
@@ -567,7 +567,19 @@ pragfpround(void)
void
pragtextflag(void)
{
- textflag = getnsn();
+ Sym *s;
+
+ s = getsym();
+ if(s == S) {
+ textflag = getnsn();
+ } else {
+ if(s->macro) {
+ macexpand(s, symb);
+ }
+ if(symb[0] < '0' || symb[0] > '9')
+ yyerror("pragma textflag not an integer");
+ textflag = atoi(symb);
+ }
while(getnsc() != '\n')
;
if(debug['f'])
@@ -577,7 +589,19 @@ pragtextflag(void)
void
pragdataflag(void)
{
- dataflag = getnsn();
+ Sym *s;
+
+ s = getsym();
+ if(s == S) {
+ dataflag = getnsn();
+ } else {
+ if(s->macro) {
+ macexpand(s, symb);
+ }
+ if(symb[0] < '0' || symb[0] > '9')
+ yyerror("pragma dataflag not an integer");
+ dataflag = atoi(symb);
+ }
while(getnsc() != '\n')
;
if(debug['f'])