Make enum generation private by default, export stub symbol

When we added enum type generation, the generated symbols used
the `ostree_` prefix, and at the time that implied they were public.

So we started (if built with libsoup) exporting
`ostree_fetcher_config_flags_get_type`.

I think it's not worth confusing ABI checkers, so let's export the
dummy symbol forever, and switch enums to be private by default.

We should revisit this and also export some auto-generated enum
types for public enums, but that's a separate patch.

Closes: #296
Approved by: gatispaeglis
This commit is contained in:
Colin Walters 2016-05-12 10:32:17 -04:00 committed by Colin Walters (automation)
parent f98b8bd0d7
commit a5f703799f
6 changed files with 66 additions and 4 deletions

View File

@ -22,6 +22,7 @@ libostree_public_headers = \
src/libostree/ostree.h \
src/libostree/ostree-async-progress.h \
src/libostree/ostree-core.h \
src/libostree/ostree-dummy-enumtypes.h \
src/libostree/ostree-mutable-tree.h \
src/libostree/ostree-repo.h \
src/libostree/ostree-types.h \

View File

@ -69,6 +69,7 @@ libostree_1_la_SOURCES = \
src/libostree/ostree-cmdprivate.c \
src/libostree/ostree-core-private.h \
src/libostree/ostree-core.c \
src/libostree/ostree-dummy-enumtypes.c \
src/libostree/ostree-checksum-input-stream.c \
src/libostree/ostree-checksum-input-stream.h \
src/libostree/ostree-chain-input-stream.c \

View File

@ -0,0 +1,32 @@
/* This file declares a stub function that is only exported
* to pacify ABI checkers - no one could really have used it.
*
* Copyright (C) 2015 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 License, 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.
*/
#include "ostree-dummy-enumtypes.h"
/* Exported for backwards compat - see
* https://bugzilla.gnome.org/show_bug.cgi?id=764131
* https://github.com/ostreedev/ostree/pull/294
*/
GType
ostree_fetcher_config_flags_get_type (void)
{
return G_TYPE_INVALID;
}

View File

@ -0,0 +1,29 @@
/* This file declares a stub function that is only exported
* to pacify ABI checkers - no one could really have used it.
*
* Copyright (C) 2015 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 License, 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.
*/
#pragma once
#include <glib-object.h>
#ifndef __GI_SCANNER__
_OSTREE_PUBLIC GType
ostree_fetcher_config_flags_get_type (void);
#endif

View File

@ -28,7 +28,7 @@
/*** BEGIN value-header ***/
GType
@enum_name@_get_type (void)
_@enum_name@_get_type (void)
{
static volatile gsize the_type__volatile = 0;

View File

@ -32,9 +32,8 @@ G_BEGIN_DECLS
/*** END file-production ***/
/*** BEGIN enumeration-production ***/
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
_OSTREE_PUBLIC
GType @enum_name@_get_type (void) G_GNUC_CONST;
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (_@enum_name@_get_type ())
GType _@enum_name@_get_type (void) G_GNUC_CONST;
/*** END enumeration-production ***/