text2pcap: fix -Wmacro-redefined warning
authorPeter Wu <peter@lekensteyn.nl>
Mon, 27 Feb 2017 09:52:08 +0000 (10:52 +0100)
committerMichael Mann <mmann78@netscape.net>
Mon, 27 Feb 2017 12:52:36 +0000 (12:52 +0000)
With flex 2.6.3, this warning is observed (which causes a build failure
when -Werror is not disabled:

    text2pcap-scanner.c:398:9: warning: 'yywrap' macro redefined [-Wmacro-redefined]
    #define yywrap() (/*CONSTCOND*/1)
            ^
    text2pcap-scanner.c:76:13: note: previous definition is here
        #define yywrap yywrap

Issue is specific to flex 2.6.3 and resolved upstream at
https://github.com/westes/flex/issues/162

Change-Id: I861565f5080f87a9457427e7a63b5d9256c49e85
Reviewed-on: https://code.wireshark.org/review/20294
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Michael Mann <mmann78@netscape.net>
text2pcap-scanner.l
text2pcap.c
text2pcap.h

index 1f45f8efdac6bce9903395ca9a5e3873cfbaf628..f422bca69ab8fc02237bf4860a6f529cb50f897e 100644 (file)
  */
 %option noyywrap
 
+/*
+ * Prefix scanner routines with "text2pcap_" rather than "yy" to avoid a
+ * "redefined macro" warning with flex 2.6.3.
+ */
+%option prefix="text2pcap_"
+
 %{
 
 /********************************************************************************
index 3ecc3511f96279421ce16dcb1f969acfa80e2a00..851cb299b342184581b823e1ae99e29cd99ae5c4 100644 (file)
@@ -245,7 +245,7 @@ static FILE       *output_file = NULL;
 /* Offset base to parse */
 static guint32 offset_base = 16;
 
-extern FILE *yyin;
+extern FILE *text2pcap_in;
 
 /* ----- State machine -----------------------------------------------------------*/
 
@@ -1899,8 +1899,8 @@ main(int argc, char *argv[])
     }
     curr_offset = header_length;
 
-    yyin = input_file;
-    if (yylex() == EXIT_SUCCESS) {
+    text2pcap_in = input_file;
+    if (text2pcap_lex() == EXIT_SUCCESS) {
         if (write_current_packet(FALSE) != EXIT_SUCCESS)
             ret = EXIT_FAILURE;
     } else {
index 3ec6b026380e726926cb6d6eb2ce57aaaa34cc69..fd3a46202cdd555114fe249accea5a6bc0ff278e 100644 (file)
@@ -42,7 +42,7 @@ typedef enum {
 
 int parse_token(token_t token, char *str);
 
-int yylex(void);
+int text2pcap_lex(void);
 
 #endif