summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2022-02-09 11:22:10 +0200
committerToomas Soome <tsoome@me.com>2022-02-17 21:40:28 +0200
commit55855f50d61b53851853bf1fdcdb04d4b63a1734 (patch)
tree2d9860537fd534a3749e177c695e1653a4550d37
parent22028508fd28d36ff74dc02c5774a8ba1f0db045 (diff)
downloadillumos-joyent-55855f50d61b53851853bf1fdcdb04d4b63a1734.tar.gz
14488 lex: clean up warnings
Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Reviewed by: Andy Fiddaman <andy@omnios.org> Approved by: Robert Mustacchi <rm@fingolfin.org>
-rw-r--r--usr/src/cmd/sgs/lex/Makefile.com3
-rw-r--r--usr/src/cmd/sgs/lex/common/sub1.c19
-rw-r--r--usr/src/cmd/sgs/lex/common/sub2.c6
-rw-r--r--usr/src/cmd/sgs/lex/common/sub3.c7
4 files changed, 18 insertions, 17 deletions
diff --git a/usr/src/cmd/sgs/lex/Makefile.com b/usr/src/cmd/sgs/lex/Makefile.com
index c8100b1e3f..1b40639314 100644
--- a/usr/src/cmd/sgs/lex/Makefile.com
+++ b/usr/src/cmd/sgs/lex/Makefile.com
@@ -55,9 +55,8 @@ SRCDIR = ../common
CSTD= $(CSTD_GNU99)
+# unused labels in yaccpar
CERRWARN += -_gcc=-Wno-unused-label
-CERRWARN += $(CNOWARN_UNINIT)
-CERRWARN += -_gcc=-Wno-parentheses
# Override default source file derivation rule (in Makefile.lib)
# from objects
diff --git a/usr/src/cmd/sgs/lex/common/sub1.c b/usr/src/cmd/sgs/lex/common/sub1.c
index f1d3fa601b..e63a55e34b 100644
--- a/usr/src/cmd/sgs/lex/common/sub1.c
+++ b/usr/src/cmd/sgs/lex/common/sub1.c
@@ -131,15 +131,16 @@ warning(char *s, ...)
{
va_list ap;
- if (!eof)
- if (!yyline)
+ if (!eof) {
+ if (!yyline) {
(void) fprintf(errorf, "Command line: ");
- else {
+ } else {
(void) fprintf(errorf,
!no_input ? "" : "\"%s\":", sargv[optind]);
(void) fprintf(errorf,
"line %d: ", yyline);
}
+ }
(void) fprintf(errorf, "Warning: ");
va_start(ap, s);
(void) vfprintf(errorf, s, ap);
@@ -171,8 +172,8 @@ index(int a, CHR *s)
int
alpha(int c)
{
- return ('a' <= c && c <= 'z' ||
- 'A' <= c && c <= 'Z');
+ return (('a' <= c && c <= 'z') ||
+ ('A' <= c && c <= 'Z'));
}
int
@@ -209,7 +210,7 @@ scopy(CHR *s, CHR *t)
{
CHR *i;
i = t;
- while (*i++ = *s++)
+ while ((*i++ = *s++) != 0)
;
}
@@ -494,7 +495,7 @@ cpycom(CHR *p)
(void) putc(*t++, fout);
}
(void) putc('\n', fout);
- while (c = gch()) {
+ while ((c = gch()) != 0) {
while (c == '*') {
(void) putc((char)c, fout);
if ((c = gch()) == '/') {
@@ -570,7 +571,7 @@ cpyact(void)
goto swt;
(void) putwc(c, fout);
savline = yyline;
- while (c = gch()) {
+ while ((c = gch()) != 0) {
while (c == '*') {
(void) putwc(c, fout);
if ((c = gch()) == '/') {
@@ -591,7 +592,7 @@ cpyact(void)
case '"': /* character string */
mth = c;
(void) putwc(c, fout);
- while (c = gch()) {
+ while ((c = gch()) != 0) {
if (c == '\\') {
(void) putwc(c, fout);
c = gch();
diff --git a/usr/src/cmd/sgs/lex/common/sub2.c b/usr/src/cmd/sgs/lex/common/sub2.c
index 84ff4e4699..399503d7d9 100644
--- a/usr/src/cmd/sgs/lex/common/sub2.c
+++ b/usr/src/cmd/sgs/lex/common/sub2.c
@@ -462,9 +462,9 @@ nextstate(int s, int c)
for (i = 0; i < num; i++) {
curpos = *pos++;
j = name[curpos];
- if ((!ISOPERATOR(j)) && j == c ||
- j == RSTR && c == right[curpos] ||
- j == RCCL && member(c, (CHR *) left[curpos])) {
+ if ((!ISOPERATOR(j) && j == c) ||
+ (j == RSTR && c == right[curpos]) ||
+ (j == RCCL && member(c, (CHR *) left[curpos]))) {
f = foll[curpos];
number = *f;
newpos = f+1;
diff --git a/usr/src/cmd/sgs/lex/common/sub3.c b/usr/src/cmd/sgs/lex/common/sub3.c
index 107881958d..4b9cea94ab 100644
--- a/usr/src/cmd/sgs/lex/common/sub3.c
+++ b/usr/src/cmd/sgs/lex/common/sub3.c
@@ -134,12 +134,13 @@ remch(wchar_t c)
* Make sure no EUC chars are used in reg. exp.
*/
if (!handleeuc) {
- if (!isascii(c))
+ if (!isascii(c)) {
if (iswprint(c))
warning(
"Non-ASCII character '%wc' in pattern; use -w or -e lex option.", c);
else warning(
"Non-ASCII character of value %#x in pattern; use -w or -e lex option.", c);
+ }
/* In any case, we don't need to construct ncgidtbl[]. */
return;
}
@@ -301,7 +302,7 @@ repbycgid(void)
symbol[j] = FALSE;
s = (CHR *) left[i];
- while (cc = *s++) {
+ while ((cc = *s++) != 0) {
if (cc == RANGE) {
int low, high, i;
/*
@@ -388,7 +389,7 @@ repbycgid(void)
static void
setsymbol(int i)
{
- if (i > sizeof (symbol))
+ if (i > (int)sizeof (symbol))
error("setsymbol: (SYSERR) %d out of range", i);
symbol[i] = TRUE;
}