mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
Move constructor macros to an internal header and into generated code
With this we're not longer exporting the constructor headers, which means we're not tying ourselves to a macro that might need special tweaking on a compiler-by-compiler basis.
This commit is contained in:
@@ -8,6 +8,11 @@ if OS_UNIX
|
||||
SUBDIRS += xdgmime
|
||||
endif
|
||||
|
||||
noinst_PROGRAMS = data-to-c
|
||||
|
||||
data_to_c_SOURCES = data-to-c.c
|
||||
data_to_c_LDADD = $(top_builddir)/glib/libglib-2.0.la
|
||||
|
||||
if OS_WIN32_AND_DLL_COMPILATION
|
||||
if MS_LIB_AVAILABLE
|
||||
noinst_DATA = gio-2.0.lib
|
||||
@@ -601,6 +606,7 @@ gioinclude_HEADERS = \
|
||||
|
||||
# these sources (also mentioned above) are generated.
|
||||
BUILT_SOURCES = \
|
||||
gconstructor_as_data.h \
|
||||
gioenumtypes.h \
|
||||
gioenumtypes.c \
|
||||
$(NULL)
|
||||
@@ -660,8 +666,12 @@ gio_querymodules_LDADD = \
|
||||
libgio-2.0.la \
|
||||
$(NULL)
|
||||
|
||||
gconstructor_as_data.h: $(top_srcdir)/glib/gconstructor.h data-to-c$(EXEEXT)
|
||||
./data-to-c $(top_srcdir)/glib/gconstructor.h gconstructor_code > gconstructor_as_data.h
|
||||
|
||||
glib_compile_schemas_LDADD = $(top_builddir)/glib/libglib-2.0.la
|
||||
glib_compile_schemas_SOURCES = \
|
||||
gconstructor_as_data.h \
|
||||
gvdb/gvdb-format.h \
|
||||
gvdb/gvdb-builder.h \
|
||||
gvdb/gvdb-builder.c \
|
||||
|
44
gio/data-to-c.c
Normal file
44
gio/data-to-c.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright © 2011 Red Hat, Inc
|
||||
*
|
||||
* This library 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; either
|
||||
* version 2 of the licence, or (at your option) any later version.
|
||||
*
|
||||
* This library 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.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Author: Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char *content;
|
||||
int i;
|
||||
|
||||
if (argc != 3)
|
||||
return 1;
|
||||
|
||||
if (!g_file_get_contents (argv[1], &content, NULL, NULL))
|
||||
return 1;
|
||||
|
||||
g_print ("const char %s[] = \"", argv[2]);
|
||||
|
||||
for (i = 0; content[i] != 0; i++) {
|
||||
g_print ("\\x%02x", (int)content[i]);
|
||||
}
|
||||
|
||||
g_print ("\";\n");
|
||||
return 0;
|
||||
}
|
@@ -45,6 +45,8 @@
|
||||
#include <glib.h>
|
||||
#include "gvdb/gvdb-builder.h"
|
||||
|
||||
#include "gconstructor_as_data.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *filename;
|
||||
@@ -765,6 +767,7 @@ main (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
static_str = "static ";
|
||||
fprintf (file, "%s", gconstructor_code);
|
||||
fprintf (file,
|
||||
"\n"
|
||||
"#ifdef G_HAS_CONSTRUCTORS\n"
|
||||
|
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include "gconstructor.h"
|
||||
#include "test_resources2.h"
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user