diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-21 15:45:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-22 10:15:40 +0100 |
commit | 4c19552052083b9b10d581f1a93f6ddecf241bcd (patch) | |
tree | d7ced7980d0bc4df3157b2fcf202dba50ccbf8f7 /soltools | |
parent | 1e603213e76975d37d091a625dfd24d1ac036d78 (diff) |
remove some unused enum values and defines in soltools
which led to a whole bunch of dead code
Change-Id: If138a05cf7f09b3020e27489b90c32776b859bcf
Reviewed-on: https://gerrit.libreoffice.org/63751
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'soltools')
-rw-r--r-- | soltools/cpp/_lex.c | 2 | ||||
-rw-r--r-- | soltools/mkdepend/def.h | 14 | ||||
-rw-r--r-- | soltools/mkdepend/parse.c | 201 |
3 files changed, 6 insertions, 211 deletions
diff --git a/soltools/cpp/_lex.c b/soltools/cpp/_lex.c index 8ba81d8e6d00..0efd303d242e 100644 --- a/soltools/cpp/_lex.c +++ b/soltools/cpp/_lex.c @@ -58,7 +58,7 @@ enum state { START = 0, NUM1, NUM2, NUM3, ID1, ST1, ST2, ST3, COM1, COM2, COM3, COM4, - CC1, CC2, WS1, PLUS1, MINUS1, STAR1, SLASH1, PCT1, SHARP1, + CC1, CC2, WS1, PLUS1, MINUS1, STAR1, PCT1, SHARP1, CIRC1, GT1, GT2, LT1, LT2, OR1, AND1, ASG1, NOT1, DOTS1, S_SELF = MAXSTATE, S_SELFB, S_EOF, S_NL, S_EOFSTR, S_STNL, S_COMNL, S_EOFCOM, S_COMMENT, S_EOB, S_WS, S_NAME diff --git a/soltools/mkdepend/def.h b/soltools/mkdepend/def.h index ed8b5faadcaa..a452fd71f0e1 100644 --- a/soltools/mkdepend/def.h +++ b/soltools/mkdepend/def.h @@ -71,24 +71,10 @@ in this Software without prior written authorization from the X Consortium. /* the following must match the directives table in main.c */ #define IF 0 -#define IFDEF 1 -#define IFNDEF 2 -#define ELSE 3 -#define ENDIF 4 -#define DEFINE 5 -#define UNDEF 6 -#define INCLUDE 7 -#define LINE 8 -#define PRAGMA 9 #define ERROR 10 -#define IDENT 11 -#define SCCS 12 #define ELIF 13 -#define EJECT 14 #define IFFALSE 15 /* pseudo value --- never matched */ #define ELIFFALSE 16 /* pseudo value --- never matched */ -#define INCLUDEDOT 17 /* pseudo value --- never matched */ -#define IFGUESSFALSE 18 /* pseudo value --- never matched */ #define ELIFGUESSFALSE 19 /* pseudo value --- never matched */ #ifdef DEBUG diff --git a/soltools/mkdepend/parse.c b/soltools/mkdepend/parse.c index 7d73aae9b068..7a8e4f96e2ac 100644 --- a/soltools/mkdepend/parse.c +++ b/soltools/mkdepend/parse.c @@ -31,10 +31,9 @@ in this Software without prior written authorization from the X Consortium. #include "def.h" static char *hash_lookup( char *symbol, struct symhash *symbols ); -static void hash_undefine( char *symbol, struct symhash *symbols ); static int gobble( struct filepointer *filep, struct inclist *file, struct inclist *file_red, struct symhash *symbols ); -static int deftype ( char *line, struct filepointer *filep, struct inclist *file, +static int deftype ( char *line, struct filepointer *filep, int parse_it, struct symhash *symbols); static int zero_value(char const *exp, struct symhash *symbols); @@ -44,10 +43,9 @@ int find_includes(struct filepointer *filep, struct inclist *file, struct inclis { char *line; int type; - boolean recfailOK; while ((line = get_line(filep))) { - type = deftype(line, filep, file, TRUE, symbols); + type = deftype(line, filep, TRUE, symbols); switch(type) { case IF: doif: @@ -56,93 +54,29 @@ int find_includes(struct filepointer *filep, struct inclist *file, struct inclis while ((type == ELIF) || (type == ELIFFALSE) || (type == ELIFGUESSFALSE)) type = gobble(filep, file, file_red, symbols); - if (type == ELSE) - gobble(filep, file, file_red, symbols); break; case IFFALSE: - case IFGUESSFALSE: doiffalse: - if (type == IFGUESSFALSE || type == ELIFGUESSFALSE) - recfailOK = TRUE; - else - recfailOK = failOK; type = gobble(filep, file, file_red, symbols); - if (type == ELSE) - find_includes(filep, file, - file_red, recursion+1, recfailOK, incCollection, symbols); - else if (type == ELIF) + if (type == ELIF) goto doif; else if ((type == ELIFFALSE) || (type == ELIFGUESSFALSE)) goto doiffalse; break; - case IFDEF: - case IFNDEF: - if ((type == IFDEF && hash_lookup(line, symbols)) - || (type == IFNDEF && !hash_lookup(line, symbols))) { - debug(1,(type == IFNDEF ? - "line %d: %s !def'd in %s via %s%s\n" : "", - filep->f_line, line, - file->i_file, file_red->i_file, ": doit")); - type = find_includes(filep, file, - file_red, recursion+1, failOK, incCollection, symbols); - while (type == ELIF || type == ELIFFALSE || type == ELIFGUESSFALSE) - type = gobble(filep, file, file_red, symbols); - if (type == ELSE) - gobble(filep, file, file_red, symbols); - } - else { - debug(1,(type == IFDEF ? - "line %d: %s !def'd in %s via %s%s\n" : "", - filep->f_line, line, - file->i_file, file_red->i_file, ": gobble")); - type = gobble(filep, file, file_red, symbols); - if (type == ELSE) - find_includes(filep, file, - file_red, recursion + 1, failOK, incCollection, symbols); - else if (type == ELIF) - goto doif; - else if (type == ELIFFALSE || type == ELIFGUESSFALSE) - goto doiffalse; - } - break; - case ELSE: case ELIFFALSE: case ELIFGUESSFALSE: case ELIF: if (!recursion) gobble(filep, file, file_red, symbols); - /*fall-through*/ - case ENDIF: if (recursion) return type; - /*fall-through*/ - case DEFINE: define(line, &symbols); break; - case UNDEF: - if (!*line) { - warning("%s, line %d: incomplete undef == \"%s\"\n", - file_red->i_file, filep->f_line, line); - break; - } - hash_undefine(line, symbols); - break; - case INCLUDE: - add_include(filep, file, file_red, line, FALSE, failOK, incCollection, symbols); - break; - case INCLUDEDOT: - add_include(filep, file, file_red, line, TRUE, failOK, incCollection, symbols); - break; case ERROR: warning("%s: %d: %s\n", file_red->i_file, filep->f_line, line); break; - case PRAGMA: - case IDENT: - case SCCS: - case EJECT: - break; case -1: warning("%s", file_red->i_file); if (file_red != file) @@ -172,35 +106,16 @@ int gobble(struct filepointer *filep, int type; while ((line = get_line(filep))) { - type = deftype(line, filep, file, FALSE, symbols); + type = deftype(line, filep, FALSE, symbols); switch(type) { case IF: case IFFALSE: - case IFGUESSFALSE: - case IFDEF: - case IFNDEF: type = gobble(filep, file, file_red, symbols); while ((type == ELIF) || (type == ELIFFALSE) || (type == ELIFGUESSFALSE)) type = gobble(filep, file, file_red, symbols); - if (type == ELSE) - (void)gobble(filep, file, file_red, symbols); break; - case ELSE: - case ENDIF: - debug(0,("%s, line %d: #%s\n", - file->i_file, filep->f_line, - directives[type])); - return type; - case DEFINE: - case UNDEF: - case INCLUDE: - case INCLUDEDOT: - case PRAGMA: case ERROR: - case IDENT: - case SCCS: - case EJECT: break; case ELIF: case ELIFFALSE: @@ -218,7 +133,7 @@ int gobble(struct filepointer *filep, /* * Decide what type of # directive this line is. */ -int deftype (char *line, struct filepointer *filep, struct inclist *file, int parse_it, struct symhash *symbols) +int deftype (char *line, struct filepointer *filep, int parse_it, struct symhash *symbols) { char *p; char *directive, savechar; @@ -287,68 +202,8 @@ int deftype (char *line, struct filepointer *filep, struct inclist *file, int pa debug(0,("%s, line %d: %s #if %s\n", file->i_file, filep->f_line, ret?"false":"true", p)); break; - case IFDEF: - case IFNDEF: - debug(0,("%s, line %d: #%s %s\n", - file->i_file, filep->f_line, directives[ret], p)); - //fall-through - case UNDEF: - /* - * separate the name of a single symbol. - */ - while (isalnum((unsigned char)*p) || *p == '_') - *line++ = *p++; - *line = '\0'; - break; - case INCLUDE: - debug(2,("%s, line %d: #include %s\n", - file->i_file, filep->f_line, p)); - - /* Support ANSI macro substitution */ - { - char *sym = hash_lookup(p, symbols); - while (sym) - { - p = sym; - debug(3,("%s : #includes SYMBOL %s\n", - file->i_incstring, - sym)); - /* mark file as having included a 'soft include' */ - file->i_included_sym = TRUE; - sym = hash_lookup(p, symbols); - } - } - - /* - * Separate the name of the include file. - */ - while (*p && *p != '"' && *p != '<') - p++; - if (! *p) - return -2; - if (*p++ == '"') { - ret = INCLUDEDOT; - while (*p && *p != '"') - *line++ = *p++; - } else - while (*p && *p != '>') - *line++ = *p++; - *line = '\0'; - break; - case DEFINE: - /* - * copy the definition back to the beginning of the line. - */ - memmove (line, p, strlen(p)); - break; - case ELSE: - case ENDIF: case ELIF: - case PRAGMA: case ERROR: - case IDENT: - case SCCS: - case EJECT: debug(0,("%s, line %d: #%s\n", file->i_file, filep->f_line, directives[ret])); /* @@ -542,50 +397,4 @@ char *hash_lookup( char *symbol, struct symhash *symbols ) return NULL; } -void hash_undefine( char *symbol, struct symhash *symbols ) -{ - int hashval; - struct pair *it; - - if ( !symbols ) - return; - - hashval = hash( symbol ); - it = symbols->s_pairs[ hashval ]; - - /* Replace/insert the symbol */ - if ( it == NULL ) - return; - else if ( strcmp( it->p_name, symbol ) == 0 ) - { - if ( it->p_next ) - { - struct pair *tmp; - it->p_name = it->p_next->p_name; - it->p_value = it->p_next->p_value; - tmp = it->p_next->p_next; - free( it->p_next ); - it->p_next = tmp; - } - else - { - free( it ); - symbols->s_pairs[ hashval ] = NULL; - } - } - else - { - while ( it->p_next && ( strcmp( it->p_next->p_name, symbol ) != 0 ) ) - { - it = it->p_next; - } - if ( it->p_next ) - { - struct pair *tmp = it->p_next; - it->p_next = it->p_next->p_next; - free( tmp ); - } - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |