ref: 727425772ef17fe710453ab97f659b82b8a6b585
parent: 3bffda9fb4ff86d00ee0e4e488447480d869da87
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Jun 28 18:44:23 EDT 2020
cc1: Change break style in lex.c The old style of writing everything in a line is obsolete.
--- a/src/cmd/cc/cc1/lex.c
+++ b/src/cmd/cc/cc1/lex.c
@@ -461,16 +461,26 @@
int c, base;
switch (*++input->p) {
- case 'a': return '\a';
- case 'f': return '\f';
- case 'n': return '\n';
- case 'r': return '\r';
- case 't': return '\t';
- case 'v': return '\v';
- case '"': return '"';
- case '\'': return '\'';
- case '\\': return '\\';
- case '\?': return '\?';
+ case 'a':
+ return '\a';
+ case 'f':
+ return '\f';
+ case 'n':
+ return '\n';
+ case 'r':
+ return '\r';
+ case 't':
+ return '\t';
+ case 'v':
+ return '\v';
+ case '"':
+ return '"';
+ case '\'':
+ return '\'';
+ case '\\':
+ return '\\';
+ case '\?':
+ return '\?';
case 'u':
/*
* FIXME: universal constants are not correctly handled
@@ -593,10 +603,15 @@
minus(void)
{
switch (*input->p++) {
- case '-': return DEC;
- case '>': return INDIR;
- case '=': return SUB_EQ;
- default: --input->p; return '-';
+ case '-':
+ return DEC;
+ case '>':
+ return INDIR;
+ case '=':
+ return SUB_EQ;
+ default:
+ --input->p;
+ return '-';
}
}
@@ -604,9 +619,13 @@
plus(void)
{
switch (*input->p++) {
- case '+': return INC;
- case '=': return ADD_EQ;
- default: --input->p; return '+';
+ case '+':
+ return INC;
+ case '=':
+ return ADD_EQ;
+ default:
+ --input->p;
+ return '+';
}
}
@@ -655,19 +674,45 @@
int t;
switch (t = *input->p++) {
- case '<': t = relational('<', LE, SHL, SHL_EQ); break;
- case '>': t = relational('>', GE, SHR, SHR_EQ); break;
- case '&': t = logic('&', AND_EQ, AND); break;
- case '|': t = logic('|', OR_EQ, OR); break;
- case '=': t = follow('=', EQ, '='); break;
- case '^': t = follow('=', XOR_EQ, '^'); break;
- case '*': t = follow('=', MUL_EQ, '*'); break;
- case '/': t = follow('=', DIV_EQ, '/'); break;
- case '!': t = follow('=', NE, '!'); break;
- case '#': t = follow('#', '$', '#'); break;
- case '-': t = minus(); break;
- case '+': t = plus(); break;
- case '.': t = dot(); break;
+ case '<':
+ t = relational('<', LE, SHL, SHL_EQ);
+ break;
+ case '>':
+ t = relational('>', GE, SHR, SHR_EQ);
+ break;
+ case '&':
+ t = logic('&', AND_EQ, AND);
+ break;
+ case '|':
+ t = logic('|', OR_EQ, OR);
+ break;
+ case '=':
+ t = follow('=', EQ, '=');
+ break;
+ case '^':
+ t = follow('=', XOR_EQ, '^');
+ break;
+ case '*':
+ t = follow('=', MUL_EQ, '*');
+ break;
+ case '/':
+ t = follow('=', DIV_EQ, '/');
+ break;
+ case '!':
+ t = follow('=', NE, '!');
+ break;
+ case '#':
+ t = follow('#', '$', '#');
+ break;
+ case '-':
+ t = minus();
+ break;
+ case '+':
+ t = plus();
+ break;
+ case '.':
+ t = dot();
+ break;
}
tok2str();
return t;