1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-05 21:02:42 +02:00

Revert "libgimpbase: #pragma once"

This reverts commit 06cd254954.

GObject Introspection tools somehow fail to introspect some macros in a
very bizarre way. See issue #14668.

I thought #pragma once was somewhat standard, but it turns out it's not.
And Wikipedia even stays about this:

> While #pragma once is available in most modern compilers, its
> implementation is tricky and might not always be reliable.

Anyway clearly it's not reliable at least regarding GIR tools. I believe
we should hold up on using #pragma once at the very least within our
libgimp* libraries. It is probably fine for app/ or plug-ins/ where we
don't need to introspect anything (and so far we haven't had any
compilation mishap because of this preprocessing directive).
This commit is contained in:
Jehan
2025-08-13 20:13:23 +02:00
parent decc8dec6c
commit 946a362d9b
22 changed files with 134 additions and 41 deletions

View File

@@ -16,14 +16,16 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_CHECKS_H__
#define __GIMP_CHECKS_H__
G_BEGIN_DECLS
/**
* GIMP_CHECK_SIZE:
*
@@ -137,4 +139,7 @@ void gimp_checks_get_colors (GimpCheckType type,
GeglColor **color1,
GeglColor **color2);
G_END_DECLS
#endif /* __GIMP_CHECKS_H__ */

View File

@@ -19,14 +19,17 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_CHOICE_H__
#define __GIMP_CHOICE_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
@@ -85,4 +88,7 @@ GParamSpec * gimp_param_spec_choice (const gchar *name,
GimpChoice * gimp_param_spec_choice_get_choice (GParamSpec *pspec);
const gchar * gimp_param_spec_choice_get_default (GParamSpec *pspec);
G_END_DECLS
#endif /* __GIMP_CHOICE_H__ */

View File

@@ -16,7 +16,9 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __GIMP_COMPAT_ENUMS_H__
#define __GIMP_COMPAT_ENUMS_H__
G_BEGIN_DECLS
@@ -46,4 +48,7 @@ typedef enum /*< skip >*/
} GimpAddMaskTypeCompat;
#endif
G_END_DECLS
#endif /* __GIMP_COMPAT_ENUMS_H__ */

View File

@@ -16,14 +16,16 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_CPU_ACCEL_H__
#define __GIMP_CPU_ACCEL_H__
G_BEGIN_DECLS
/**
* GimpCpuAccelFlags:
* @GIMP_CPU_ACCEL_NONE: None
@@ -64,4 +66,7 @@ typedef enum
GimpCpuAccelFlags gimp_cpu_accel_get_support (void);
G_END_DECLS
#endif /* __GIMP_CPU_ACCEL_H__ */

View File

@@ -18,7 +18,8 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __GIMP_ENV_PRIVATE_H__
#define __GIMP_ENV_PRIVATE_H__
G_BEGIN_DECLS
@@ -27,4 +28,7 @@ G_BEGIN_DECLS
void gimp_env_init (gboolean plug_in);
G_END_DECLS
#endif /* __GIMP_ENV_PRIVATE_H__ */

View File

@@ -19,12 +19,13 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_ENV_H__
#define __GIMP_ENV_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
@@ -76,4 +77,7 @@ void gimp_path_free (GList *path);
gchar * gimp_path_get_user_writable_dir (GList *path) G_GNUC_MALLOC;
G_END_DECLS
#endif /* __GIMP_ENV_H__ */

View File

@@ -18,14 +18,17 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_EXPORT_OPTIONS_H__
#define __GIMP_EXPORT_OPTIONS_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
@@ -34,6 +37,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GimpExportOptions, gimp_export_options, GIMP, EXPORT_OPTIONS, GObject)
/*
* GIMP_TYPE_PARAM_EXPORT_OPTIONS
*/
@@ -49,4 +53,7 @@ GParamSpec * gimp_param_spec_export_options (const gchar *name,
const gchar *blurb,
GParamFlags flags);
G_END_DECLS
#endif /* __GIMP_EXPORT_OPTIONS_H__ */

View File

@@ -19,14 +19,16 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_LIMITS_H__
#define __GIMP_LIMITS_H__
G_BEGIN_DECLS
/**
* SECTION: gimplimits
* @title: gimplimits
@@ -89,4 +91,7 @@ G_BEGIN_DECLS
* and must be < G_MAXDOUBLE
*/
G_END_DECLS
#endif /* __GIMP_LIMITS_H__ */

View File

@@ -16,14 +16,16 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_MEMSIZE_H__
#define __GIMP_MEMSIZE_H__
G_BEGIN_DECLS
/**
* GIMP_TYPE_MEMSIZE:
*
@@ -57,4 +59,7 @@ GParamSpec * gimp_param_spec_memsize (const gchar *name,
guint64 default_value,
GParamFlags flags);
G_END_DECLS
#endif /* __GIMP_MEMSIZE_H__ */

View File

@@ -19,17 +19,16 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <gexiv2/gexiv2.h>
#ifndef __GIMP_METADATA_H__
#define __GIMP_METADATA_H__
G_BEGIN_DECLS
#include <gexiv2/gexiv2.h>
#define GIMP_TYPE_METADATA (gimp_metadata_get_type ())
G_DECLARE_FINAL_TYPE (GimpMetadata,
gimp_metadata,
GIMP, METADATA,
GExiv2Metadata)
G_DECLARE_FINAL_TYPE (GimpMetadata, gimp_metadata, GIMP, METADATA, GExiv2Metadata)
/**
@@ -158,3 +157,5 @@ gboolean gimp_metadata_is_tag_supported (const gchar *tag,
const gchar *mime_type);
G_END_DECLS
#endif /* __GIMP_METADATA_H__ */

View File

@@ -18,12 +18,13 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_PARAM_SPECS_H__
#define __GIMP_PARAM_SPECS_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
@@ -409,4 +410,7 @@ GParamSpec * gimp_param_spec_core_object_array (const gchar *
GType gimp_param_spec_core_object_array_get_object_type (GParamSpec *pspec);
G_END_DECLS
#endif /* __GIMP_PARAM_SPECS_H__ */

View File

@@ -19,12 +19,13 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_PARASITE_H__
#define __GIMP_PARASITE_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
@@ -108,3 +109,5 @@ gconstpointer gimp_parasite_get_data (const GimpParasite *parasite,
guint32 *num_bytes);
G_END_DECLS
#endif /* __GIMP_PARASITE_H__ */

View File

@@ -19,7 +19,8 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __GIMP_PARASITE_IO_H__
#define __GIMP_PARASITE_IO_H__
G_BEGIN_DECLS
@@ -82,3 +83,5 @@ gchar * gimp_pixpipe_params_build (GimpPixPipeParams *params) G_GNUC_MALLOC;
void gimp_pixpipe_params_free (GimpPixPipeParams *params);
G_END_DECLS
#endif /* __GIMP_PARASITE_IO_H__ */

View File

@@ -16,7 +16,8 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __GIMP_PROTOCOL_H__
#define __GIMP_PROTOCOL_H__
G_BEGIN_DECLS
@@ -417,4 +418,7 @@ gboolean gp_extension_ack_write (GIOChannel *channel,
gboolean gp_has_init_write (GIOChannel *channel,
gpointer user_data);
G_END_DECLS
#endif /* __GIMP_PROTOCOL_H__ */

View File

@@ -16,12 +16,13 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_RECTANGLE_H__
#define __GIMP_RECTANGLE_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
@@ -53,4 +54,7 @@ void gimp_rectangle_union (gint x1,
gint *dest_width,
gint *dest_height);
G_END_DECLS
#endif /* __GIMP_RECTANGLE_H__ */

View File

@@ -10,10 +10,12 @@
* more information and how to use this.
*/
#pragma once
#ifndef __GIMP_RELOC_H__
#define __GIMP_RELOC_H__
G_BEGIN_DECLS
/* These error codes can be returned from _gimp_reloc_init() or
* _gimp_reloc_init_lib().
*/
@@ -38,4 +40,7 @@ G_GNUC_INTERNAL gboolean _gimp_reloc_init_lib (GError **error);
G_GNUC_INTERNAL gchar * _gimp_reloc_find_prefix (const gchar *default_prefix);
G_END_DECLS
#endif /* _GIMPRELOC_H_ */

View File

@@ -16,7 +16,8 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __GIMP_SIGNAL_H__
#define __GIMP_SIGNAL_H__
#include <signal.h>
@@ -37,9 +38,11 @@ G_BEGIN_DECLS
**/
typedef void (* GimpSignalHandlerFunc) (gint signum);
GimpSignalHandlerFunc gimp_signal_private (gint signum,
GimpSignalHandlerFunc handler,
gint flags);
G_END_DECLS
#endif /* __GIMP_SIGNAL_H__ */

View File

@@ -16,14 +16,16 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_UTILS_H__
#define __GIMP_UTILS_H__
G_BEGIN_DECLS
gchar * gimp_utf8_strtrim (const gchar *str,
gint max_chars) G_GNUC_MALLOC;
gchar * gimp_any_to_utf8 (const gchar *str,
@@ -90,3 +92,5 @@ void gimp_bind_text_domain (const gchar *domain_
const gchar *dir_name);
G_END_DECLS
#endif /* __GIMP_UTILS_H__ */

View File

@@ -18,12 +18,13 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_VALUE_ARRAY_H__
#define __GIMP_VALUE_ARRAY_H__
G_BEGIN_DECLS
/**
@@ -96,4 +97,7 @@ GParamSpec * gimp_param_spec_value_array (const gchar *name,
GParamSpec * gimp_param_spec_value_array_get_element_spec (GParamSpec *pspec);
G_END_DECLS
#endif /* __GIMP_VALUE_ARRAY_H__ */

View File

@@ -1,4 +1,5 @@
#pragma once
#ifndef __GIMP_VERSION_H__
#define __GIMP_VERSION_H__
/* gimpversion.h.in -> gimpversion.h
* This file is configured by Meson. Please modify meson.build files.
@@ -61,4 +62,7 @@ G_BEGIN_DECLS
(GIMP_MAJOR_VERSION == (major) && GIMP_MINOR_VERSION == (minor) && \
GIMP_MICRO_VERSION >= (micro)))
G_END_DECLS
#endif /* __GIMP_VERSION_H__ */

View File

@@ -19,13 +19,15 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __GIMP_WIN32_IO_H__
#define __GIMP_WIN32_IO_H__
#include <io.h>
#include <direct.h>
G_BEGIN_DECLS
#define mkdir(n,a) _mkdir(n)
#define chmod(n,f) _chmod(n,f)
#define access(f,p) _access(f,p)
@@ -93,3 +95,5 @@ G_BEGIN_DECLS
#endif
G_END_DECLS
#endif /* __GIMP_WIN32_IO_H__ */

View File

@@ -16,7 +16,8 @@
* <https://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __GIMP_WIRE_H__
#define __GIMP_WIRE_H__
G_BEGIN_DECLS
@@ -145,4 +146,7 @@ G_GNUC_INTERNAL gboolean
gint count,
gpointer user_data);
G_END_DECLS
#endif /* __GIMP_WIRE_H__ */