[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #54702] [grn] "implicit fallthrough" warnings from compiler
From: |
G. Branden Robinson |
Subject: |
[bug #54702] [grn] "implicit fallthrough" warnings from compiler |
Date: |
Thu, 2 Jun 2022 17:10:36 -0400 (EDT) |
Update of bug #54702 (project groff):
Status: Confirmed => Fixed
Assigned to: bgarrigues => gbranden
Open/Closed: Open => Closed
Planned Release: None => 1.23.0
Summary: [PATCH] [grn] "implicit fallthrough" warnings from
compiler => [grn] "implicit fallthrough" warnings from compiler
_______________________________________________________
Follow-up Comment #4:
I fixed this differently.
commit d247763cfe9e71fd453ac828d35ab8b207c962fd
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date: Fri Apr 15 09:09:26 2022 +1000
[grn]: Slightly refactor.
* src/preproc/grn/hdb.cpp (DBGetType): Lower fatal diagnostics to errors
when encounting invalid element type characters. Return a value
interpreted by our caller as an error indication instead. Helps
compilers determine that we're not implicitly falling through our
cases. Addresses "-Wimplicit-fallthrough" warnings from GCC.
diff --git a/src/preproc/grn/hdb.cpp b/src/preproc/grn/hdb.cpp
index e8cd9675e..9ba3eaa80 100644
--- a/src/preproc/grn/hdb.cpp
+++ b/src/preproc/grn/hdb.cpp
@@ -325,9 +325,9 @@ DBGetType(char *s)
case 'R':
return (CENTRIGHT);
default:
- fatal_with_file_and_line(gremlinfile, lineno,
+ error_with_file_and_line(gremlinfile, lineno,
"unknown element type '%1'", s);
- // fatal_with_file_and_line() does not return
+ return -1;
}
case 'B':
switch (s[3]) {
@@ -338,9 +338,9 @@ DBGetType(char *s)
case 'R':
return (BOTRIGHT);
default:
- fatal_with_file_and_line(gremlinfile, lineno,
+ error_with_file_and_line(gremlinfile, lineno,
"unknown element type '%1'", s);
- // fatal_with_file_and_line() does not return
+ return -1;
}
case 'T':
switch (s[3]) {
@@ -351,16 +351,15 @@ DBGetType(char *s)
case 'R':
return (TOPRIGHT);
default:
- fatal_with_file_and_line(gremlinfile, lineno,
+ error_with_file_and_line(gremlinfile, lineno,
"unknown element type '%1'", s);
- // fatal_with_file_and_line() does not return
+ return -1;
}
default:
- fatal_with_file_and_line(gremlinfile, lineno,
+ error_with_file_and_line(gremlinfile, lineno,
"unknown element type '%1'", s);
+ return -1;
}
-
- return 0; /* never reached */
}
#ifdef UW_FASTSCAN
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?54702>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #54702] [grn] "implicit fallthrough" warnings from compiler,
G. Branden Robinson <=