aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2022-11-19 22:52:09 +0000
committerJoão Valverde <j@v6e.pt>2022-11-20 10:11:27 +0000
commit79c3a77752bfee8e57cac3796d5e5ef1987e5612 (patch)
treedd903014caf5145faf5b220afa435d1b653044cf /plugins
parentc4ca4312c1c17cf48a1e956d0cd2e6ab5e04d4f2 (diff)
Add macros to control lemon diagnostics
Rename flex macros using parenthesis (mostly a style issue): DIAG_OFF_FLEX -> DIAG_OFF_FLEX() DIAG_ON_FLEX -> DIAG_ON_FLEX() Use the same kind of construct with lemon generated code using DIAG_OFF_LEMON() and DIAG_ON_LEMON(). Use %include and %code directives to enforce the desired order with generated code in the middle in between pragmas. Fix a clang-specific pragma to use DIAG_OFF_CLANG(). DIAG_OFF(unreachable-code) -> DIAG_OFF_CLANG(unreachable-code). Apparently GCC is ignoring the -Wunreachable flag, that's why it did not trigger an unknown pragma warning. From [1}: The -Wunreachable-code has been removed, because it was unstable: it relied on the optimizer, and so different versions of gcc would warn about different code. The compiler still accepts and ignores the command line option so that existing Makefiles are not broken. In some future release the option will be removed entirely. - Ian [1] https://gcc.gnu.org/legacy-ml/gcc-help/2011-05/msg00360.html
Diffstat (limited to 'plugins')
-rw-r--r--plugins/epan/mate/mate_grammar.lemon8
-rw-r--r--plugins/epan/mate/mate_parser.l4
-rw-r--r--plugins/epan/wimaxasncp/wimaxasncp_dict.l4
3 files changed, 9 insertions, 7 deletions
diff --git a/plugins/epan/mate/mate_grammar.lemon b/plugins/epan/mate/mate_grammar.lemon
index 802c6b8dab..be66915928 100644
--- a/plugins/epan/mate/mate_grammar.lemon
+++ b/plugins/epan/mate/mate_grammar.lemon
@@ -26,9 +26,6 @@
#include <wsutil/file_util.h>
#include <wsutil/str_util.h>
-/* Generated lemon code warns on this. */
-DIAG_OFF(unreachable-code)
-
#define DUMMY void*
typedef struct _extraction {
@@ -171,6 +168,11 @@ static gchar* recolonize(mate_config* mc, gchar* s) {
return r;
}
+DIAG_OFF_LEMON()
+} /* end of %include */
+
+%code {
+DIAG_ON_LEMON()
}
%name MateParser
diff --git a/plugins/epan/mate/mate_parser.l b/plugins/epan/mate/mate_parser.l
index ad08c9ea7a..6e423abccd 100644
--- a/plugins/epan/mate/mate_parser.l
+++ b/plugins/epan/mate/mate_parser.l
@@ -87,7 +87,7 @@
/*
* Disable diagnostics in the code generated by Flex.
*/
-DIAG_OFF_FLEX
+DIAG_OFF_FLEX()
void MateParseTrace(FILE*,char*);
@@ -337,7 +337,7 @@ blk_cmnt_stop "*/"
/*
* Turn diagnostics back on, so we check the code that we've written.
*/
-DIAG_ON_FLEX
+DIAG_ON_FLEX()
static void ptr_array_free(gpointer data, gpointer user_data _U_)
{
diff --git a/plugins/epan/wimaxasncp/wimaxasncp_dict.l b/plugins/epan/wimaxasncp/wimaxasncp_dict.l
index 3b42207e5e..05fa2e51eb 100644
--- a/plugins/epan/wimaxasncp/wimaxasncp_dict.l
+++ b/plugins/epan/wimaxasncp/wimaxasncp_dict.l
@@ -104,7 +104,7 @@
/*
* Disable diagnostics in the code generated by Flex.
*/
-DIAG_OFF_FLEX
+DIAG_OFF_FLEX()
typedef struct entity_t {
gchar *name;
@@ -517,7 +517,7 @@ since_attr since=\042
/*
* Turn diagnostics back on, so we check the code that we've written.
*/
-DIAG_ON_FLEX
+DIAG_ON_FLEX()
static int debugging = 0;