summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2018-09-09 01:00:42 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2018-09-09 01:16:25 +0200
commit7b34167d7dac6e898c49c675cfc80ae68c64bc98 (patch)
tree235f3c3a32ef8c5a4601b32638ff42c0e86cbd6f
parent01db90cd83edbcd2f806ece2c2d1620478f51c8f (diff)
lib: early-include "config.h" in flex lexers
This is neccessary to get _FILE_OFFSET_BITS right. Signed-off-by: David Lamparter <equinox@diac24.net>
-rw-r--r--lib/command_lex.l5
-rw-r--r--lib/defun_lex.l7
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/command_lex.l b/lib/command_lex.l
index 0d6e6ee7e5..3b18b58a2e 100644
--- a/lib/command_lex.l
+++ b/lib/command_lex.l
@@ -22,6 +22,11 @@
* 02111-1307, USA.
*/
+%top{
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+}
%{
/* ignore flex generated code in static analyzer */
#ifndef __clang_analyzer__
diff --git a/lib/defun_lex.l b/lib/defun_lex.l
index d901c26a2e..6c0805a4fa 100644
--- a/lib/defun_lex.l
+++ b/lib/defun_lex.l
@@ -1,4 +1,3 @@
-%{
/*
* clippy (CLI preparator in python) C pseudo-lexer
* Copyright (C) 2016-2017 David Lamparter for NetDEF, Inc.
@@ -34,6 +33,12 @@
* code documentation in it.
*/
+%top{
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+}
+%{
/* ignore harmless bugs in old versions of flex */
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wunused-value"