@@ -22,7 +22,6 @@
#include "libxlu_internal.h"
#include "libxlu_cfg_y.h"
#include "libxlu_cfg_l.h"
-#include "libxlu_cfg_i.h"
XLU_Config *xlu_cfg_init(FILE *report, const char *report_source) {
XLU_Config *cfg;
deleted file mode 100644
@@ -1,53 +0,0 @@
-/*
- * libxlu_cfg_i.h - xl configuration file parsing: parser-internal declarations
- *
- * Copyright (C) 2010 Citrix Ltd.
- * Author Ian Jackson <ian.jackson@eu.citrix.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; version 2.1 only. with the special
- * exception on linking described in file LICENSE.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- */
-
-#ifndef LIBXLU_CFG_I_H
-#define LIBXLU_CFG_I_H
-
-#include "libxlu_internal.h"
-#include "libxlu_cfg_y.h"
-
-void xlu__cfg_set_free(XLU_ConfigSetting *set);
-void xlu__cfg_set_store(CfgParseContext*, char *name,
- enum XLU_Operation op,
- XLU_ConfigValue *val, int lineno);
-XLU_ConfigValue *xlu__cfg_string_mk(CfgParseContext *ctx,
- char *atom, YYLTYPE *loc);
-XLU_ConfigValue *xlu__cfg_list_mk(CfgParseContext *ctx,
- XLU_ConfigValue *val,
- YYLTYPE *loc);
-void xlu__cfg_list_append(CfgParseContext *ctx,
- XLU_ConfigValue *list,
- XLU_ConfigValue *val);
-void xlu__cfg_value_free(XLU_ConfigValue *value);
-char *xlu__cfgl_strdup(CfgParseContext*, const char *src);
-char *xlu__cfgl_dequote(CfgParseContext*, const char *src);
-
-void xlu__cfg_yyerror(YYLTYPE *locp, CfgParseContext*, char const *msg);
-void xlu__cfgl_lexicalerror(CfgParseContext*, char const *msg);
-
-void xlu__cfgl_likely_python(CfgParseContext *ctx);
-
-#endif /*LIBXLU_CFG_I_H*/
-
-/*
- * Local variables:
- * mode: C
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
@@ -17,7 +17,7 @@
*/
%{
-#include "libxlu_cfg_i.h"
+#include "libxlu_cfg_y.h"
#define ctx ((CfgParseContext*)yyextra)
#define YY_NO_INPUT
@@ -16,9 +16,36 @@
* GNU Lesser General Public License for more details.
*/
+%code requires {
+#include "libxlu_internal.h"
+}
+
+%code provides {
+void xlu__cfg_set_free(XLU_ConfigSetting *set);
+void xlu__cfg_set_store(CfgParseContext*, char *name,
+ enum XLU_Operation op,
+ XLU_ConfigValue *val, int lineno);
+XLU_ConfigValue *xlu__cfg_string_mk(CfgParseContext *ctx,
+ char *atom, YYLTYPE *loc);
+XLU_ConfigValue *xlu__cfg_list_mk(CfgParseContext *ctx,
+ XLU_ConfigValue *val,
+ YYLTYPE *loc);
+void xlu__cfg_list_append(CfgParseContext *ctx,
+ XLU_ConfigValue *list,
+ XLU_ConfigValue *val);
+void xlu__cfg_value_free(XLU_ConfigValue *value);
+char *xlu__cfgl_strdup(CfgParseContext*, const char *src);
+char *xlu__cfgl_dequote(CfgParseContext*, const char *src);
+
+void xlu__cfg_yyerror(YYLTYPE *locp, CfgParseContext*, char const *msg);
+void xlu__cfgl_lexicalerror(CfgParseContext*, char const *msg);
+
+void xlu__cfgl_likely_python(CfgParseContext *ctx);
+}
+
%{
#define ctx_scanner ctx->scanner
-#include "libxlu_cfg_i.h"
+#include "libxlu_cfg_y.h"
#include "libxlu_cfg_l.h"
%}
Bison has added the ability to emit declarations in its header. As such everything can instead be dumped in Bison's header instead of having a private one. This resolves the mixed up situation with the libxlu headers. Problem is libxlu_cfg_i.h was trying to function as a wrapper for libxlu_cfg_y.h. Issue is libxlu_cfg.c's #include order didn't match and thus everything was fragile. Fixes: b104c3762d ('Replace config file parser for "xl"') Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com> --- The bug @b104c3762d was the incorrect ordering of #includes in libxlu_cfg.c. It should instead have been: #include "libxlu_cfg_i.h" #include "libxlu_cfg_l.h" Had this bug not been present, later commits might have looked deeper and chosen correct solutions. Instead this resulted in all the ripples which this series fixes. I'm unsure whether Bison had implemented the %code feature by this point in time. The one and a half remaining issues are whether to convert the %{ %} section to %code and move it after the %union. The %union construct ends up in libxlu_cfg_y.h, whereas the %{ %}/%code construct ends up in libxlu_cfg_y.c. --- tools/libs/util/libxlu_cfg.c | 1 - tools/libs/util/libxlu_cfg_i.h | 53 ---------------------------------- tools/libs/util/libxlu_cfg_l.l | 2 +- tools/libs/util/libxlu_cfg_y.y | 29 ++++++++++++++++++- 4 files changed, 29 insertions(+), 56 deletions(-) delete mode 100644 tools/libs/util/libxlu_cfg_i.h