History

cpp: #pragma once support

Jacob Moody committed 3 years ago

Commit 7e3063e1 parent 0c5e15b3 files · +28 −1Browse files

Showing the changes to sys/src/cmd/cpp/cpp.c (1 of 3 files). Show all

Unified · Split

sys/src/cmd/cpp/cpp.c+12−1
@@ -85,6 +85,7 @@ control(Tokenrow *trp) · 84 unmodified lines
85{85{
86 Nlist *np;86 Nlist *np;
87 Token *tp;87 Token *tp;
88 Dir *d;
88 89
89 tp = trp->tp;90 tp = trp->tp;
90 if (tp->type!=NAME) {91 if (tp->type!=NAME) {
@@ -148,7 +149,17 @@ control(Tokenrow *trp) · 57 unmodified lines
148 break;149 break;
149 150
150 case KPRAGMA:151 case KPRAGMA:
151 return;152 tp += 1;
153 if (tp->type!=NAME || tp->len < 4 || memcmp(tp->t, "once", 4) != 0)
154 return;
155 if (nblocked >= NONCE)
156 error(FATAL, "#pragma once list max length exceeded");
157 d = dirfstat(cursource->fd);
158 if (d == nil)
159 error(FATAL, "Out of memory from dirfstat");
160 incblocked[nblocked++] = d->qid;
161 free(d);
162 break;
152 163
153 case KIFDEF:164 case KIFDEF:
154 case KIFNDEF:165 case KIFNDEF:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t