Errors when compiling 0.22
Stepan Kasal
skasal at redhat.com
Wed Dec 12 04:10:10 PST 2007
Hello Tomas,
On Tue, Dec 11, 2007 at 10:20:30PM +0100, Tomas Larsson wrote:
> I'm trying to compile pkg-config 0.22.
...
> testglib.c:86: warning: reading through null pointer (arg 5)
I was able to reproduce this on my Fedora 8.
After a quick look to current glib sources, I realize that the
warnings can be eliminated by a simple patch, attached below.
But I do not know what is the policy about patching the imported
glib-1.2.8 package, we have to wait for the maintainer.
BTW: The patch was created by GNU sed 4.1.5:
cd pkg-config-0.22
cd glib-1.2.8
sed -i 's/\((gchar\*)m\)\(.*\\\)$/m ? \1 : ""\2/' test*.c tests/*.c
Have a nice day,
Stepan Kasal
-------------- next part --------------
2007-12-12 Stepan Kasal <skasal at redhat.com>
In glib-1.2.8:
* testglib.c, testgdate.c, tests/array-test.c,
tests/dirname-test.c, tests/list-test.c, tests/node-test.c,
tests/relation-test.c, tests/slist-test.c,
tests/strfunc-test.c, tests/string-test.c, tests/tree-test.c:
Prevent null pointer warnings.
diff -ur pkg-config-0.22/glib-1.2.8.orig/testgdate.c pkg-config-0.22/glib-1.2.8/testgdate.c
--- pkg-config-0.22/glib-1.2.8.orig/testgdate.c 2000-05-19 08:43:50.000000000 +0200
+++ pkg-config-0.22/glib-1.2.8/testgdate.c 2007-12-12 12:57:37.000000000 +0100
@@ -16,7 +16,7 @@
if (!m) \
g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
else \
- g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
+ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
} \
else \
++passed; \
diff -ur pkg-config-0.22/glib-1.2.8.orig/testglib.c pkg-config-0.22/glib-1.2.8/testglib.c
--- pkg-config-0.22/glib-1.2.8.orig/testglib.c 1999-07-17 11:48:46.000000000 +0200
+++ pkg-config-0.22/glib-1.2.8/testglib.c 2007-12-12 12:57:37.000000000 +0100
@@ -38,7 +38,7 @@
{ if (!m) \
g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
else \
- g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
+ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
} \
else \
g_print ("."); fflush (stdout); \
diff -ur pkg-config-0.22/glib-1.2.8.orig/tests/array-test.c pkg-config-0.22/glib-1.2.8/tests/array-test.c
--- pkg-config-0.22/glib-1.2.8.orig/tests/array-test.c 1999-02-24 07:14:16.000000000 +0100
+++ pkg-config-0.22/glib-1.2.8/tests/array-test.c 2007-12-12 12:57:37.000000000 +0100
@@ -38,7 +38,7 @@
{ if (!m) \
g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
else \
- g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
+ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
} \
else \
g_print ("."); fflush (stdout); \
diff -ur pkg-config-0.22/glib-1.2.8.orig/tests/dirname-test.c pkg-config-0.22/glib-1.2.8/tests/dirname-test.c
--- pkg-config-0.22/glib-1.2.8.orig/tests/dirname-test.c 1999-02-24 07:14:18.000000000 +0100
+++ pkg-config-0.22/glib-1.2.8/tests/dirname-test.c 2007-12-12 12:57:37.000000000 +0100
@@ -38,7 +38,7 @@
{ if (!m) \
g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
else \
- g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
+ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
} \
else \
g_print ("."); fflush (stdout); \
diff -ur pkg-config-0.22/glib-1.2.8.orig/tests/list-test.c pkg-config-0.22/glib-1.2.8/tests/list-test.c
--- pkg-config-0.22/glib-1.2.8.orig/tests/list-test.c 1999-02-24 07:14:20.000000000 +0100
+++ pkg-config-0.22/glib-1.2.8/tests/list-test.c 2007-12-12 12:57:37.000000000 +0100
@@ -38,7 +38,7 @@
{ if (!m) \
g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
else \
- g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
+ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
} \
else \
g_print ("."); fflush (stdout); \
diff -ur pkg-config-0.22/glib-1.2.8.orig/tests/node-test.c pkg-config-0.22/glib-1.2.8/tests/node-test.c
--- pkg-config-0.22/glib-1.2.8.orig/tests/node-test.c 1999-07-17 11:48:51.000000000 +0200
+++ pkg-config-0.22/glib-1.2.8/tests/node-test.c 2007-12-12 12:57:37.000000000 +0100
@@ -48,7 +48,7 @@
{ if (!m) \
g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
else \
- g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
+ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
exit(1); \
} \
} G_STMT_END
diff -ur pkg-config-0.22/glib-1.2.8.orig/tests/relation-test.c pkg-config-0.22/glib-1.2.8/tests/relation-test.c
--- pkg-config-0.22/glib-1.2.8.orig/tests/relation-test.c 1999-02-24 07:14:22.000000000 +0100
+++ pkg-config-0.22/glib-1.2.8/tests/relation-test.c 2007-12-12 12:57:37.000000000 +0100
@@ -38,7 +38,7 @@
{ if (!m) \
g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
else \
- g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
+ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
} \
else \
g_print ("."); fflush (stdout); \
diff -ur pkg-config-0.22/glib-1.2.8.orig/tests/slist-test.c pkg-config-0.22/glib-1.2.8/tests/slist-test.c
--- pkg-config-0.22/glib-1.2.8.orig/tests/slist-test.c 1999-02-24 07:14:23.000000000 +0100
+++ pkg-config-0.22/glib-1.2.8/tests/slist-test.c 2007-12-12 12:57:37.000000000 +0100
@@ -38,7 +38,7 @@
{ if (!m) \
g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
else \
- g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
+ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
} \
else \
g_print ("."); fflush (stdout); \
diff -ur pkg-config-0.22/glib-1.2.8.orig/tests/strfunc-test.c pkg-config-0.22/glib-1.2.8/tests/strfunc-test.c
--- pkg-config-0.22/glib-1.2.8.orig/tests/strfunc-test.c 1999-02-24 07:14:24.000000000 +0100
+++ pkg-config-0.22/glib-1.2.8/tests/strfunc-test.c 2007-12-12 12:57:37.000000000 +0100
@@ -38,7 +38,7 @@
{ if (!m) \
g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
else \
- g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
+ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
} \
else \
g_print ("."); fflush (stdout); \
diff -ur pkg-config-0.22/glib-1.2.8.orig/tests/string-test.c pkg-config-0.22/glib-1.2.8/tests/string-test.c
--- pkg-config-0.22/glib-1.2.8.orig/tests/string-test.c 1999-07-17 11:48:51.000000000 +0200
+++ pkg-config-0.22/glib-1.2.8/tests/string-test.c 2007-12-12 12:57:37.000000000 +0100
@@ -38,7 +38,7 @@
{ if (!m) \
g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
else \
- g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
+ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
} \
else \
g_print ("."); fflush (stdout); \
diff -ur pkg-config-0.22/glib-1.2.8.orig/tests/tree-test.c pkg-config-0.22/glib-1.2.8/tests/tree-test.c
--- pkg-config-0.22/glib-1.2.8.orig/tests/tree-test.c 1999-02-24 07:14:26.000000000 +0100
+++ pkg-config-0.22/glib-1.2.8/tests/tree-test.c 2007-12-12 12:57:37.000000000 +0100
@@ -38,7 +38,7 @@
{ if (!m) \
g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
else \
- g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
+ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), m ? (gchar*)m : ""); \
} \
else \
g_print ("."); fflush (stdout); \
More information about the pkg-config
mailing list