[PATCH] config.h must be the very first included file
Evgeny Litvinenko
evgeny.v.litvinenko at gmail.com
Wed Sep 4 15:54:28 CDT 2019
All included headers must be able to react on defines in config.h.
Also this removes gcc's warning messages - 'warning: "XYZ" redefined'.
---
tools/widl/parser.l | 9 ++++++++-
tools/wrc/parser.l | 10 ++++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index 3cbf4ff2d2..ca355a11c9 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -40,9 +40,16 @@ double [0-9]+\.[0-9]+([eE][+-]?[0-9]+)*
%x PP_PRAGMA
%x SQUOTE
+%top{
+/**
+ * config.h must be included as the very first line of your code after comments,
+ * so that all other header files can react on the defines.
+ */
+#include "config.h"
+}
+
%{
-#include "config.h"
#include "wine/port.h"
#include <stdio.h>
diff --git a/tools/wrc/parser.l b/tools/wrc/parser.l
index f456c626d1..5687ab2086 100644
--- a/tools/wrc/parser.l
+++ b/tools/wrc/parser.l
@@ -91,12 +91,18 @@
/* Some shortcut definitions */
ws [ \f\t\r]
+%top{
+/**
+ * config.h must be included as the very first line of your code after comments,
+ * so that all other header files can react on the defines.
+ */
+#include "config.h"
+}
+
%{
/*#define LEX_DEBUG*/
-#include "config.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--
2.23.0
More information about the wine-devel
mailing list