Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(18)

Unified Diff: src/cmd/dist/buildruntime.c

Issue 140740043: code review 140740043: runtime: include constants and defs_*_*.h types in gene... (Closed)
Patch Set: diff -r 40906c63a04eeb1fc292cd559e57bfcdeff64e7f https://code.google.com/p/go/ Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/cc/godefs.c ('k') | src/pkg/runtime/defs.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/cmd/dist/buildruntime.c
===================================================================
--- a/src/cmd/dist/buildruntime.c
+++ b/src/cmd/dist/buildruntime.c
@@ -346,6 +346,10 @@
"\n"
);
+ // Do not emit constant definitions for these.
+ vadd(&seen, "true");
+ vadd(&seen, "false");
+ vadd(&seen, "raceenabled");
// Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -q -n -o workdir/runtimedefs
// on each of the runtimedefs C files.
@@ -375,15 +379,15 @@
splitlines(&lines, bstr(&in));
for(i=0; i<lines.len; i++) {
p = lines.p[i];
- // Drop comment, func, and const lines.
- if(hasprefix(p, "//") || hasprefix(p, "const") || hasprefix(p, "func"))
+ // Drop comment and func lines.
+ if(hasprefix(p, "//") || hasprefix(p, "func"))
continue;
// Note beginning of type or var decl, which can be multiline.
// Remove duplicates. The linear check of seen here makes the
// whole processing quadratic in aggregate, but there are only
// about 100 declarations, so this is okay (and simple).
- if(hasprefix(p, "type ") || hasprefix(p, "var ")) {
+ if(hasprefix(p, "type ") || hasprefix(p, "var ") || hasprefix(p, "const ")) {
splitfields(&fields, p);
if(fields.len < 2)
continue;
@@ -394,6 +398,17 @@
}
vadd(&seen, fields.p[1]);
}
+
+ // Const lines are printed in original case (usually upper). Add a leading _ as needed.
+ if(hasprefix(p, "const ")) {
+ if('A' <= p[6] && p[6] <= 'Z')
+ bwritestr(&out, "const _");
+ else
+ bwritestr(&out, "const ");
+ bwritestr(&out, p+6);
+ continue;
+ }
+
if(skip) {
if(hasprefix(p, "}"))
skip = 0;
« no previous file with comments | « src/cmd/cc/godefs.c ('k') | src/pkg/runtime/defs.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b