From 85d1beb70e07a8520606db93d0cc9a533f167fc5 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 27 May 2008 14:32:55 -0700 Subject: regs.pl: regdis.h needs "extern"; minor cleanups The declarations in regdis.h need to be "extern", since they are external data. regdis.c should include regdis.h. Minor stylistic cleanups in regs.c. --- regs.pl | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/regs.pl b/regs.pl index 49a34c6..a56fa01 100755 --- a/regs.pl +++ b/regs.pl @@ -80,21 +80,21 @@ if ( $fmt eq 'h' ) { # Output regs.h print "/* automatically generated from $file - do not edit */\n\n"; $expr_regs = 1; - printf "#define EXPR_REG_START %d\n", $expr_regs; + printf "#define EXPR_REG_START %d\n\n", $expr_regs; print "enum reg_enum {\n"; + # Unfortunately the code uses both 0 and -1 as "no register" in + # different places... + print " R_zero = 0,\n"; + print " R_none = -1,\n"; $attach = ' = EXPR_REG_START'; # EXPR_REG_START == 1 foreach $reg ( sort(keys(%regs)) ) { print " R_\U${reg}\E${attach},\n"; $attach = ''; $expr_regs++; } - print " REG_ENUM_LIMIT,\n"; - # Unfortunately the code uses both 0 and -1 as "no register" in - # different places... - print " R_zero = 0,\n"; - print " R_none = -1"; + print " REG_ENUM_LIMIT\n"; print "};\n\n"; - printf "#define EXPR_REG_END %d\n", $expr_regs-1; + printf "#define EXPR_REG_END %d\n\n", $expr_regs-1; foreach $reg ( sort(keys(%regs)) ) { printf "#define %-15s %2d\n", "REG_NUM_\U${reg}", $regvals{$reg}; } @@ -137,7 +137,8 @@ if ( $fmt eq 'h' ) { } elsif ( $fmt eq 'dc' ) { # Output regdis.c print "/* automatically generated from $file - do not edit */\n\n"; - print "#include \"regs.h\"\n\n"; + print "#include \"regs.h\"\n"; + print "#include \"regdis.h\"\n\n"; foreach $class ( sort(keys(%disclass)) ) { printf "const enum reg_enum nasm_rd_%-8s[%2d] = {", $class, scalar @{$disclass{$class}}; @@ -156,7 +157,7 @@ if ( $fmt eq 'h' ) { # Output regdis.h print "/* automatically generated from $file - do not edit */\n"; foreach $class ( sort(keys(%disclass)) ) { - printf "const enum reg_enum nasm_rd_%-8s[%2d];\n", + printf "extern const enum reg_enum nasm_rd_%-8s[%2d];\n", $class, scalar @{$disclass{$class}}; } } else { -- cgit v1.2.3