[hackers] [scc] Remove definition of letters in cc.h || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sat, 23 Jan 2016 10:20:11 +0100 (CET)

commit c4e13ecd202af5a26d6040a8f076fd14bc001e9e
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sat Jan 23 07:28:11 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sat Jan 23 07:28:11 2016 +0100

    Remove definition of letters in cc.h
    
    It is impossible to make a total separation between
    cc1 and cc2 without writing very bad code, so it is
    better to mark totally the isolation between them,
    because at this moment we have some constants in
    cc.h and others hardcoded in code.c.

diff --git a/cc1/cc1.h b/cc1/cc1.h
index 430b4e7..c281143 100644
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
_AT_@ -123,6 +123,31 @@ struct input {
  * Definition of enumerations
  */
 
+/* data type letters */
+enum {
+ L_INT8 = 'C',
+ L_INT16 = 'I',
+ L_INT32 = 'W',
+ L_INT64 = 'Q',
+ L_UINT8 = 'K',
+ L_UINT16 = 'N',
+ L_UINT32 = 'Z',
+ L_UINT64 = 'O',
+ L_BOOL = 'B',
+
+ L_FLOAT = 'J',
+ L_DOUBLE = 'D',
+ L_LDOUBLE = 'H',
+
+ L_ELLIPSIS = 'E',
+ L_VOID = '0',
+ L_POINTER = 'P',
+ L_FUNCTION = 'F',
+ L_ARRAY = 'V',
+ L_UNION = 'U',
+ L_STRUCT = 'S',
+};
+
 /* recovery points */
 enum {
         END_DECL,
diff --git a/cc1/code.c b/cc1/code.c
index 0216653..651f7d7 100644
--- a/cc1/code.c
+++ b/cc1/code.c
_AT_@ -166,19 +166,19 @@ emitvar(Symbol *sym)
         short flags = sym->flags;
 
         if (flags & ISLOCAL)
- c = L_LOCAL;
+ c = 'T';
         else if (flags & ISPRIVATE)
- c = L_PRIVATE;
+ c = 'Y';
         else if (flags & ISGLOBAL)
- c = L_PUBLIC;
+ c = 'G';
         else if (flags & ISREGISTER)
- c = L_REGISTER;
+ c = 'R';
         else if (flags & ISFIELD)
- c = L_FIELD;
+ c = 'M';
         else if (flags & ISEXTERN)
- c = L_EXTERN;
+ c = 'X';
         else
- c = L_AUTO;
+ c = 'A';
         printf("%c%u", c, sym->id);
 }
 
diff --git a/inc/cc.h b/inc/cc.h
index 2c44600..bcab69e 100644
--- a/inc/cc.h
+++ b/inc/cc.h
_AT_@ -16,39 +16,6 @@ extern int debug;
 #define DBGON()
 #endif
 
-#define L_INT8 'C'
-#define L_INT16 'I'
-#define L_INT32 'W'
-#define L_INT64 'Q'
-#define L_UINT8 'K'
-#define L_UINT16 'N'
-#define L_UINT32 'Z'
-#define L_UINT64 'O'
-#define L_BOOL 'B'
-
-#define L_FLOAT 'J'
-#define L_DOUBLE 'D'
-#define L_LDOUBLE 'H'
-
-#define L_ELLIPSIS 'E'
-#define L_VOID '0'
-#define L_POINTER 'P'
-#define L_FUNCTION 'F'
-#define L_ARRAY 'V'
-#define L_UNION 'U'
-#define L_STRUCT 'S'
-
-#define L_PUBLIC 'G'
-#define L_PRIVATE 'Y'
-#define L_LOCAL 'T'
-#define L_REGISTER 'R'
-#define L_FIELD 'M'
-#define L_AUTO 'A'
-#define L_EXTERN 'X'
-#define L_LABEL 'L'
-
-#define L_NAME '"'
-
 extern void die(const char *fmt, ...);
 extern void dbg(const char *fmt, ...);
 extern void *xmalloc(size_t size);
Received on Sat Jan 23 2016 - 10:20:11 CET

This archive was generated by hypermail 2.3.0 : Sat Jan 23 2016 - 10:24:23 CET