mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-10-05 21:02:42 +02:00
libgimp*, plug-ins: add and use new GIMP_WARNING_API_BREAK() macro.
This macro will generate a #warning message when we'll move on to 3.99 series (which means we will be on our way to GIMP 4). And it will become an #error message on 4.0.0, hence preventing us from releasing unless we actually resolve all these warnings. Resolution may mean actually breaking the API/ABI, or just deciding that it's not a good idea in the end, or finding another solution. But something will have to be decided. Please everyone use this macro when you discover issues where it looks like we could improve the API (in a breaking way) so that we don't forget when approaching GIMP 4 (pushing further the improvement). Updating the 2 place where I was already using a GIMP_CHECK_VERSION() with #warning, and adding a new usage in the compose plug-in, per discussion in MR !2424.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "gimp.h"
|
||||
|
||||
#include "libgimpbase/gimpversion-private.h"
|
||||
#include "libgimpbase/gimpwire.h" /* FIXME kill this include */
|
||||
|
||||
#include "gimpvectorloadprocedure.h"
|
||||
@@ -132,9 +133,7 @@ gimp_vector_load_procedure_constructed (GObject *object)
|
||||
FALSE,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
#if GIMP_CHECK_VERSION(3, 99, 0)
|
||||
#warning Make per-coordinate x/y pixel density. Simplify plug-ins/common/file-svg.c code when not keeping ratio.
|
||||
#endif
|
||||
GIMP_WARNING_API_BREAK("Make per-coordinate x/y pixel density. Simplify plug-ins/common/file-svg.c code when not keeping ratio.")
|
||||
|
||||
/* Note: the "pixel-density" is saved in pixels per inch. "physical-unit"
|
||||
* property is only there for display.
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <gegl.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "libgimpbase/gimpversion-private.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
#include "gimpbasetypes.h"
|
||||
@@ -41,9 +42,7 @@
|
||||
#include "libgimp/libgimp-intl.h"
|
||||
|
||||
|
||||
#if GIMP_CHECK_VERSION(3, 99, 0)
|
||||
#warning libgimpbase/gimpmetadata.h: rename GIMP_METADATA_SAVE_UPDATE as GIMP_METADATA_UPDATE?
|
||||
#endif
|
||||
GIMP_WARNING_API_BREAK("libgimpbase/gimpmetadata.h: rename GIMP_METADATA_SAVE_UPDATE as GIMP_METADATA_UPDATE?")
|
||||
|
||||
/**
|
||||
* SECTION: gimpmetadata
|
||||
|
66
libgimpbase/gimpversion-private.h
Normal file
66
libgimpbase/gimpversion-private.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpversion-private.h
|
||||
* Copyright (C) 2025 Jehan
|
||||
*
|
||||
* 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 3 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, see
|
||||
* <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_VERSION_PRIVATE_H__
|
||||
#define __GIMP_VERSION_PRIVATE_H__
|
||||
|
||||
#include <libgimpbase/gimpversion.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* GIMP_WARNING_API_BREAK:
|
||||
* @message: the message to output either as build WARNING or ERROR.
|
||||
*
|
||||
* Internal macro to use when we consider an API break, so that we don't
|
||||
* forget to look at it when the time comes:
|
||||
*
|
||||
* - When the minor version reaches 99 (e.g. 3.99), the message will be
|
||||
* outputted as a compilation warning.
|
||||
* - When the minor and micro versions are 0.0 (e.g. 4.0.0), the message
|
||||
* will be outputted as compilation error, hence forbidding a major
|
||||
* release unless we resolve all the API break warnings (in any way,
|
||||
* it can be by actually breaking the API, or by deciding that this is
|
||||
* not a valid change anymore).
|
||||
*
|
||||
* Note: this macro relies on the "GCC warning" pragma which was tested
|
||||
* to work on clang too. Assuming/hoping it works on other compilers.
|
||||
**/
|
||||
|
||||
#if GIMP_CHECK_VERSION(GIMP_MAJOR_VERSION, 99, 0)
|
||||
#define GIMP_PRAGMA(pragma) _Pragma(#pragma)
|
||||
#define GIMP_WARNING_MSG(message) GIMP_PRAGMA(GCC warning #message)
|
||||
|
||||
#define GIMP_WARNING_API_BREAK(message) GIMP_WARNING_MSG(message)
|
||||
#elif GIMP_MINOR_VERSION == 0 && GIMP_MICRO_VERSION == 0
|
||||
#define GIMP_PRAGMA(pragma) _Pragma(#pragma)
|
||||
#define GIMP_ERROR_MSG(message) GIMP_PRAGMA(GCC error #message)
|
||||
|
||||
#define GIMP_WARNING_API_BREAK(message) \
|
||||
GIMP_ERROR_MSG("API break warning needs to be handled before releasing: " message)
|
||||
#else
|
||||
#define GIMP_WARNING_API_BREAK(message)
|
||||
#endif
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_VERSION_PRIVATE_H__ */
|
@@ -41,6 +41,7 @@
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimpbase/gimpversion-private.h"
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
|
||||
@@ -1036,6 +1037,7 @@ compose (const gchar *compose_type,
|
||||
}
|
||||
}
|
||||
|
||||
GIMP_WARNING_API_BREAK("Update 'decompose-type' choices? See discussion in MR !2424.")
|
||||
/* TODO: The strings used in decompose.c's "decompose-type" do not match
|
||||
* the values of compose_type for YCbCr values. We'll need to wait until
|
||||
* the next API break to fix. For now, we can do additional checks if the
|
||||
|
Reference in New Issue
Block a user