- Added patches dia-configure-c99.patch,

dia-0.97.3-get_data_size.patch, dia-0.97.3-const-ft_vector.patch,
  dia-0.97.3-g_test_add_data_func_1.patch and
  dia-0.97.3-g_test_add_data_func_2.patch to address C99 compliance
  issues (mainly use of incompatible pointer types) that are errors by
  default with GCC 14 [boo#1224536].  All of these patches were taken
  from the Fedora dia package.

Please (assuming the request is OK) forward to Factory soon-ish too so
that we can switch the default compiler.  Thanks.

OBS-URL: https://build.opensuse.org/package/show/GNOME:Apps/dia?expand=0&rev=56
This commit is contained in:
Bjørn Lie 2024-07-09 18:25:56 +00:00 committed by Git OBS Bridge
parent 22d33d7613
commit 78fbdb4202
7 changed files with 351 additions and 0 deletions

View File

@ -0,0 +1,83 @@
From e5557aa1d396bc3ca80240f7b5c0a1831a5cf209 Mon Sep 17 00:00:00 2001
From: Hans Breuer <hans@breuer.org>
Date: Sat, 4 May 2013 15:20:15 +0200
Subject: [PATCH] [warningectomy] initialization from incompatible pointer type
FT_Outline_Funcs take const FT_Vector* nowadays.
---
plug-ins/postscript/diapsft2renderer.c | 28 +++++++++++++-------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/plug-ins/postscript/diapsft2renderer.c b/plug-ins/postscript/diapsft2renderer.c
index 63aac74b5..ed4182e5e 100644
--- a/plug-ins/postscript/diapsft2renderer.c
+++ b/plug-ins/postscript/diapsft2renderer.c
@@ -61,16 +61,16 @@ void draw_bezier_outline(DiaPsRenderer *renderer,
double pos_y
);
/* Countour traveling functions */
-static int paps_move_to( FT_Vector* to,
+static int paps_move_to( const FT_Vector* to,
void *user_data);
-static int paps_line_to( FT_Vector* to,
+static int paps_line_to( const FT_Vector* to,
void *user_data);
-static int paps_conic_to( FT_Vector* control,
- FT_Vector* to,
+static int paps_conic_to( const FT_Vector* control,
+ const FT_Vector* to,
void *user_data);
-static int paps_cubic_to( FT_Vector* control1,
- FT_Vector* control2,
- FT_Vector* to,
+static int paps_cubic_to( const FT_Vector* control1,
+ const FT_Vector* control2,
+ const FT_Vector* to,
void *user_data);
static void dia_ps_ft2_renderer_class_init (DiaPsFt2RendererClass *klass);
@@ -111,7 +111,7 @@ set_font(DiaRenderer *self, DiaFont *font, real height)
/*======================================================================
outline traversing functions.
----------------------------------------------------------------------*/
-static int paps_move_to( FT_Vector* to,
+static int paps_move_to( const FT_Vector* to,
void *user_data)
{
OutlineInfo *outline_info = (OutlineInfo*)user_data;
@@ -121,7 +121,7 @@ static int paps_move_to( FT_Vector* to,
return 0;
}
-static int paps_line_to( FT_Vector* to,
+static int paps_line_to( const FT_Vector* to,
void *user_data)
{
OutlineInfo *outline_info = (OutlineInfo*)user_data;
@@ -131,8 +131,8 @@ static int paps_line_to( FT_Vector* to,
return 0;
}
-static int paps_conic_to( FT_Vector* control,
- FT_Vector* to,
+static int paps_conic_to( const FT_Vector* control,
+ const FT_Vector* to,
void *user_data)
{
OutlineInfo *outline_info = (OutlineInfo*)user_data;
@@ -144,9 +144,9 @@ static int paps_conic_to( FT_Vector* control,
return 0;
}
-static int paps_cubic_to( FT_Vector* control1,
- FT_Vector* control2,
- FT_Vector* to,
+static int paps_cubic_to( const FT_Vector* control1,
+ const FT_Vector* control2,
+ const FT_Vector* to,
void *user_data)
{
OutlineInfo *outline_info = (OutlineInfo*)user_data;
--
GitLab

View File

@ -0,0 +1,31 @@
From caddfcab250fe677ecf294fad835b71e6b10cf26 Mon Sep 17 00:00:00 2001
From: Hans Breuer <hans@breuer.org>
Date: Fri, 3 Oct 2014 22:26:36 +0200
Subject: [PATCH] [warningectomy] incompatible pointer types passing ...
test-boundingbox.c:152:58: warning: incompatible pointer types passing 'void (const struct _TestBeziers *)' to parameter of type 'GTestDataFunc' (aka 'void (*)(gconstpointer)') [-Wincompatible-pointer-types]
g_test_add_data_func (testpath, &_test_beziers[i], _check_one_bezier);
^~~~~~~~~~~~~~~~~
test-svg.c:117:55: warning: incompatible pointer types passing 'void (const PathData *)' to parameter of type 'GTestDataFunc' (aka 'void (*)(gconstpointer)') [-Wincompatible-pointer-types]
g_test_add_data_func (testpath, &_test_path[i], _check_one_path);
^~~~~~~~~~~~~~~
---
tests/test-boundingbox.c | 3 ++-
tests/test-svg.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/test-boundingbox.c b/tests/test-boundingbox.c
index f5b57250e..f542e590d 100644
--- a/tests/test-boundingbox.c
+++ b/tests/test-boundingbox.c
@@ -132,8 +132,9 @@ static struct _TestBeziers {
#undef BEZ
static void
-_check_one_bezier (const struct _TestBeziers *test)
+_check_one_bezier (gconstpointer p)
{
+ const struct _TestBeziers *test = p;
Rectangle rect;
PolyBBExtras extra = {0, T*.7, T*.7, T*.7, 0 };

View File

@ -0,0 +1,48 @@
Backport from https://gitlab.gnome.org/GNOME/dia/-/commit/9c481f649414190bf8d6741cbca1777e9766756b
--- dia-0.97.3/tests/test-objects.c 2014-08-24 17:46:02.000000000 +0200
+++ dia-0.97.3/tests/test-objects.c.g_test_add_data_func_2 2024-03-03 01:01:53.832977690 +0100
@@ -39,8 +39,9 @@
int num_objects = 0;
static void
-_test_creation (const DiaObjectType *type)
+_test_creation (gconstpointer user_data)
{
+ const DiaObjectType *type = (const DiaObjectType *)user_data;
int i;
Handle *h1 = NULL, *h2 = NULL;
Point point = {0, 0};
@@ -112,8 +113,9 @@
}
static void
-_test_copy (const DiaObjectType *type)
+_test_copy (gconstpointer user_data)
{
+ const DiaObjectType *type = (const DiaObjectType *)user_data;
Handle *h1 = NULL, *h2 = NULL;
Point from = {0, 0};
DiaObject *oc, *o = type->ops->create (&from, type->default_user_data, &h1, &h2);
@@ -172,8 +174,9 @@
}
static void
-_test_movement (const DiaObjectType *type)
+_test_movement (gconstpointer user_data)
{
+ const DiaObjectType *type = (const DiaObjectType *)user_data;
Handle *h1 = NULL, *h2 = NULL;
Point from = {0, 0};
DiaObject *o = type->ops->create (&from, type->default_user_data, &h1, &h2);
@@ -215,8 +218,9 @@
}
static void
-_test_change (const DiaObjectType *type)
+_test_change (gconstpointer user_data)
{
+ const DiaObjectType *type = (const DiaObjectType *)user_data;
Handle *h1 = NULL, *h2 = NULL;
Point from = {0, 0};
DiaObject *o = type->ops->create (&from, type->default_user_data, &h1, &h2);

View File

@ -0,0 +1,128 @@
Backport from https://gitlab.gnome.org/GNOME/dia/-/commit/f57ea2685034ddbafc19f35d9b525a12283d7c24
--- dia-0.97.3/lib/prop_geomtypes.c 2014-08-24 17:46:01.000000000 +0200
+++ dia-0.97.3/lib/prop_geomtypes.c.get_data_size 2024-03-02 22:11:06.700789662 +0100
@@ -129,9 +129,10 @@
}
static int
-realprop_get_data_size(RealProperty *prop)
+realprop_get_data_size(void)
{
- return sizeof (prop->real_data);
+ RealProperty prop;
+ return sizeof (prop.real_data);
}
static const PropertyOps realprop_ops = {
@@ -242,9 +243,10 @@
}
static int
-lengthprop_get_data_size(LengthProperty *prop)
+lengthprop_get_data_size(void)
{
- return sizeof (prop->length_data);
+ LengthProperty prop;
+ return sizeof (prop.length_data);
}
static const PropertyOps lengthprop_ops = {
@@ -358,9 +360,10 @@
}
static int
-fontsizeprop_get_data_size(FontsizeProperty *prop)
+fontsizeprop_get_data_size(void)
{
- return sizeof (prop->fontsize_data);
+ FontsizeProperty prop;
+ return sizeof (prop.fontsize_data);
}
static const PropertyOps fontsizeprop_ops = {
--- dia-0.97.3/lib/prop_inttypes.c 2014-08-24 17:46:01.000000000 +0200
+++ dia-0.97.3/lib/prop_inttypes.c.get_data_size 2024-03-02 22:12:01.683149664 +0100
@@ -122,9 +122,10 @@
}
static int
-charprop_get_data_size(CharProperty *prop)
+charprop_get_data_size(void)
{
- return sizeof (prop->char_data);
+ CharProperty prop;
+ return sizeof (prop.char_data);
}
@@ -229,9 +230,10 @@
}
static int
-boolprop_get_data_size(BoolProperty *prop)
+boolprop_get_data_size(void)
{
- return sizeof (prop->bool_data);
+ BoolProperty prop;
+ return sizeof (prop.bool_data);
}
@@ -339,9 +341,10 @@
}
static int
-intprop_get_data_size(IntProperty *prop)
+intprop_get_data_size(void)
{
- return sizeof (prop->int_data);
+ IntProperty prop;
+ return sizeof (prop.int_data);
}
static const PropertyOps intprop_ops = {
--- dia-0.97.3/lib/prop_text.c 2014-08-24 17:46:01.000000000 +0200
+++ dia-0.97.3/lib/prop_text.c.get_data_size 2024-03-02 22:12:46.741444615 +0100
@@ -208,9 +208,10 @@
}
static int
-stringprop_get_data_size(StringProperty *prop)
+stringprop_get_data_size(void)
{
- return sizeof (prop->string_data); /* only the pointer */
+ StringProperty prop;
+ return sizeof (prop.string_data); /* only the pointer */
}
static StringListProperty *
--- dia-0.97.3/lib/properties.h 2014-08-24 17:46:01.000000000 +0200
+++ dia-0.97.3/lib/properties.h.get_data_size 2024-03-02 22:13:08.051584089 +0100
@@ -116,7 +116,7 @@
void *base, guint offset, guint offset2);
typedef void (*PropertyType_SetFromOffset)(Property *prop,
void *base, guint offset, guint offset2);
-typedef int (*PropertyType_GetDataSize)(Property *prop);
+typedef int (*PropertyType_GetDataSize)(void);
struct _PropertyOps {
--- dia-0.97.3/objects/custom/custom_object.c 2014-08-24 17:46:01.000000000 +0200
+++ dia-0.97.3/objects/custom/custom_object.c.get_data_size 2024-03-02 22:13:29.153722188 +0100
@@ -372,14 +372,7 @@
info->prop_offsets[i].name = info->props[i].name;
info->prop_offsets[i].type = info->props[i].type;
info->prop_offsets[i].offset = offs;
- /* FIXME:
- custom_object.c:328: warning: passing arg 1 of pointer to function
- from incompatible pointer type
- We don't have a Property* here so there is not much we can do about.
- Maybe it even works cause the sizeof() in *_get_data_size can be
- calculated at compile time. Anyway, a mess ;) --hb
- */
- size = info->props[i].ops->get_data_size (&info->props[i]);
+ size = info->props[i].ops->get_data_size ();
info->ext_attr_size += size;
offs += size;
}

33
dia-configure-c99.patch Normal file
View File

@ -0,0 +1,33 @@
C99 removes support for implicit ints, so declare the return type
of main explicitly. Future compilers are likely to require explicit
type declarations.
Upstream has switched to Meson, and it does not seem to use this
particular check anymore.
diff --git a/configure b/configure
index 14cdc757c3ee0f15..504ae93d8e3a4f48 100755
--- a/configure
+++ b/configure
@@ -17571,7 +17571,7 @@ $as_echo_n "checking for png_structp in png.h... " >&6; }
png_structp pp;
png_infop info;
png_colorp cmap;
- main() { void*foo = png_create_read_struct; }
+ int main(void) { void*foo = png_create_read_struct; }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
png_ok=yes
diff --git a/configure.in b/configure.in
index c5edeeddf766d5fb..f90ed4ef953af139 100644
--- a/configure.in
+++ b/configure.in
@@ -197,7 +197,7 @@ if test "$png_ok" = yes; then
png_structp pp;
png_infop info;
png_colorp cmap;
- main() { void*foo = png_create_read_struct; }],
+ int main(void) { void*foo = png_create_read_struct; }],
png_ok=yes,
png_ok=no)
LDFLAGS="${old_LDFLAGS}"

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Mon Jul 8 14:01:36 UTC 2024 - Martin Jambor <mjambor@suse.com>
- Added patches dia-configure-c99.patch,
dia-0.97.3-get_data_size.patch, dia-0.97.3-const-ft_vector.patch,
dia-0.97.3-g_test_add_data_func_1.patch and
dia-0.97.3-g_test_add_data_func_2.patch to address C99 compliance
issues (mainly use of incompatible pointer types) that are errors by
default with GCC 14 [boo#1224536]. All of these patches were taken
from the Fedora dia package.
-------------------------------------------------------------------
Thu Feb 8 16:04:53 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>

View File

@ -38,6 +38,17 @@ Patch17: dia-remove-datetime.patch
Patch20: dia-libemf-64bit.patch
# PATCH-FIX-OPENSUSE dia-enable-html-doc.patch mgorse@suse.com -- Always enable html docs if xsltproc present.
Patch23: dia-enable-html-doc.patch
# PATCH-FIX-OPENSUSE dia-configure-c99.patch boo#1224536 mjambor@suse.cz -- Fix configure issue with GCC 14, from https://src.fedoraproject.org/rpms/dia/c/0a14169fc36b959598074065678e0126830317f8?branch=rawhide
Patch30: dia-configure-c99.patch
# PATCH-FIX-UPSTREAM dia-0.97.3-get_data_size.patch boo#1224536 mjambor@suse.cz -- One of upstream patches for -Wincompatible-pointer-types
Patch31: dia-0.97.3-get_data_size.patch
# PATCH-FIX-UPSTREAM dia-0.97.3-const-ft_vector.patch boo#1224536 mjambor@suse.cz -- One of upstream patches for -Wincompatible-pointer-types
Patch32: dia-0.97.3-const-ft_vector.patch
# PATCH-FIX-UPSTREAM dia-0.97.3-g_test_add_data_func_1.patch boo#1224536 mjambor@suse.cz -- One of upstream patches for -Wincompatible-pointer-types
Patch33: dia-0.97.3-g_test_add_data_func_1.patch
# PATCH-FIX-UPSTREAM dia-0.97.3-g_test_add_data_func_2.patch boo#1224536 mjambor@suse.cz -- One of upstream patches for -Wincompatible-pointer-types
Patch34: dia-0.97.3-g_test_add_data_func_2.patch
BuildRequires: docbook-xsl-stylesheets
BuildRequires: fdupes
BuildRequires: gcc-c++
@ -89,6 +100,12 @@ pages).
%patch -P 17 -p1
%patch -P 20 -p1
%patch -P 23 -p1
%patch -P 30 -p1
%patch -P 31 -p1
%patch -P 32 -p1
%patch -P 33 -p1
%patch -P 34 -p1
cp $RPM_SOURCE_DIR/font-test*dia .
%build