[grilo-plugins] lua-factory: Sanitize code generation



commit 3c61220469dbeb9b40d0a9866bf5aa8444b271f6
Author: Jan Alexander Steffens (heftig) <jan steffens gmail com>
Date:   Tue Feb 21 17:57:28 2017 +0100

    lua-factory: Sanitize code generation
    
    Now that gperf is required to build this plugin, the generated
    htmlentity.c should be removed from the source. Otherwise, it
    will be used iff builddir == srcdir.
    
    Add some further adjustments to make sure out-of-tree builds don't
    break.
    
    gperf 3.1 changes the type of the len argument for the generated
    function to size_t, causing a conflict. Replace the prototype with
    pragmas to make GCC ignore -Werror=missing-prototypes.
    
    Tested with "make distcheck" and meson, with gcc and clang.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=778857

 src/lua-factory/Makefile.am                  |   11 +-
 src/lua-factory/lua-library/htmlentity.c     |  876 --------------------------
 src/lua-factory/lua-library/htmlentity.gperf |   14 +-
 src/lua-factory/meson.build                  |   10 +-
 4 files changed, 20 insertions(+), 891 deletions(-)
---
diff --git a/src/lua-factory/Makefile.am b/src/lua-factory/Makefile.am
index 5a57f0e..8f64e69 100644
--- a/src/lua-factory/Makefile.am
+++ b/src/lua-factory/Makefile.am
@@ -33,14 +33,16 @@ libgrlluafactory_la_SOURCES =                                       \
        grl-lua-library-operations.c                            \
        grl-lua-library-operations.h                            \
        grl-lua-common.h                                        \
-       luafactoryresources.c                                   \
-       luafactoryresources.h                                   \
-       lua-library/htmlentity.c                                \
        lua-library/htmlentity.h                                \
        lua-library/lua-json.c                                  \
        lua-library/lua-xml.c                                   \
        lua-library/lua-libraries.h
 
+nodist_libgrlluafactory_la_SOURCES =                           \
+       luafactoryresources.c                                   \
+       luafactoryresources.h                                   \
+       lua-library/htmlentity.c
+
 extdir                 = $(GRL_PLUGINS_DIR)
 
 lua_factory_resources_files =  \
@@ -56,7 +58,8 @@ luafactoryresources.h: grl-lua-factory.gresource.xml
 
 CLEANFILES =                           \
        luafactoryresources.h           \
-       luafactoryresources.c
+       luafactoryresources.c           \
+       lua-library/htmlentity.c
 
 EXTRA_DIST +=                                  \
        $(lua_factory_resources_files)          \
diff --git a/src/lua-factory/lua-library/htmlentity.gperf b/src/lua-factory/lua-library/htmlentity.gperf
index cbd326c..5e20f3a 100644
--- a/src/lua-factory/lua-library/htmlentity.gperf
+++ b/src/lua-factory/lua-library/htmlentity.gperf
@@ -28,15 +28,18 @@
 #include <stdlib.h>
 
 #include <glib.h>
-#include "htmlentity.h"
+#include <lua-library/htmlentity.h>
+
+#ifdef __GNUC__
+_Pragma ("GCC diagnostic push")
+_Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"")
+#endif
 
 %}
 struct _EntityEntry {
        const gchar *name;
        gulong value;
 };
-struct _EntityEntry *
-html_entity_hash (register const char *str, register unsigned int len);
 %%
 Aacute, 193
 aacute, 225
@@ -292,6 +295,11 @@ zeta, 950
 zwj, 8205
 zwnj, 8204
 %%
+
+#ifdef __GNUC__
+_Pragma ("GCC diagnostic pop")
+#endif
+
 gulong
 html_entity_parse (const gchar *s, guint len)
 {
diff --git a/src/lua-factory/meson.build b/src/lua-factory/meson.build
index c2aaa32..cfdb7f6 100644
--- a/src/lua-factory/meson.build
+++ b/src/lua-factory/meson.build
@@ -23,6 +23,7 @@ lua_library_sources = [
     'lua-library/lua-json.c',
     'lua-library/lua-xml.c',
     'lua-library/lua-libraries.h',
+    'lua-library/htmlentity.h',
 ]
 
 gperf_gen = generator(gperf,
@@ -39,14 +40,7 @@ gperf_gen = generator(gperf,
 htmlentity_c = gperf_gen.process(
     'lua-library/htmlentity.gperf')
 
-htmlentity_h = configure_file(input: 'lua-library/htmlentity.h',
-    output: 'htmlentity.h',
-    configuration: configuration_data())
-
-lua_library_sources += [
-    htmlentity_c,
-    htmlentity_h,
-]
+lua_library_sources += [ htmlentity_c ]
 
 configure_file(output: 'config.h',
     configuration: cdata)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]