CFLAGS=$safe_CFLAGS
+# does this compiler support -Wno-uninitialized ?
+
+AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
+
+safe_CFLAGS=$CFLAGS
+CFLAGS="-Wno-uninitialized"
+
+AC_TRY_COMPILE(
+[ ],
+[
+ return 0;
+],
+[
+AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
+AC_MSG_RESULT([yes])
+],
+[
+AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
+AC_MSG_RESULT([no])
+])
+CFLAGS=$safe_CFLAGS
+
+
# does this compiler support -Wextra or the older -W ?
AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
deep_templates_SOURCES = deep_templates.cpp
deep_templates_CXXFLAGS = $(AM_CFLAGS) -O -gstabs
+error_counts_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
+
+inits_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
+
long_namespace_xml_SOURCES = long_namespace_xml.cpp
+manuel1_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
+
memcmptest_CFLAGS = $(AM_CFLAGS) -fno-builtin-memcmp
mismatches_SOURCES = mismatches.cpp
new_nothrow_SOURCES = new_nothrow.cpp
new_override_SOURCES = new_override.cpp
+origin2_not_quite_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
+
+origin3_no_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@
+
# This requires optimisation in order to get just one resulting error.
origin4_many_CFLAGS = $(AM_CFLAGS) -O
#include <stdio.h>
#include <stdlib.h>
-
+static void* return_arg(void* q);
int main ( void )
{
void* p = (void*)0x87654321;
free(p);
/* Free a pointer to a stack block */
- free(q);
+ free(return_arg(q));
return 0;
}
+
+/*
+ * The only purpose of the function below is to make sure that gcc 4.4.x does
+ * not print the following warning during the compilation of this test program:
+ * warning: attempt to free a non-heap object
+ */
+static void* return_arg(void* q)
+{
+ return q;
+}
+
#include <stdlib.h>
#include <stdio.h>
-
+static void* return_arg(void* p);
int frame3 ( void )
{
int *a = malloc(10 * sizeof(int));
free(a);
// more invalid frees
- free(&n);
+ free(return_arg(&n));
// leak ..
a = malloc(99 * sizeof(int));
{
return frame1() - 1;
}
+
+/*
+ * The only purpose of the function below is to make sure that gcc 4.4.x does
+ * not print the following warning during the compilation of this test program:
+ * warning: attempt to free a non-heap object
+ */
+static void* return_arg(void* p)
+{
+ return p;
+}
+