Skip to content

Commit 4451f22

Browse files
authored
Merge pull request #3005 from beutlich/remove-clang-warning
Silence clang warning -Wtautological-pointer-compare
2 parents 3c7fd97 + 3f28a5d commit 4451f22

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

Modelica/Resources/BuildProjects/autotools/configure.ac

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ AC_SUBST(LIBZLIB)
1414
AC_SUBST(LIBHDF5)
1515
dnl Check for HDF5, etc
1616

17+
AC_DEFUN([C_FLAG_CHECK_AND_ADD],
18+
[dnl
19+
AC_MSG_CHECKING([if $CC supports $1])
20+
AC_LANG_PUSH([C])
21+
ac_saved_cflags="$CFLAGS"
22+
CFLAGS="-Werror $1"
23+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
24+
[AC_MSG_RESULT([yes])],
25+
[AC_MSG_ERROR([no]) ; CFLAGS="$ac_saved_cflags"]
26+
)
27+
AC_LANG_POP([C])
28+
])
29+
30+
C_FLAG_CHECK_AND_ADD([-fno-delete-null-pointer-checks])
31+
1732
AC_SEARCH_LIBS([floor],[m])
1833

1934
LIBS_BEFORE="$LIBS"

Modelica/Resources/BuildProjects/gcc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
AR = ar -ru
22
RM = rm -f
33

4-
CFLAGS = -O3 -Wno-attributes
4+
CFLAGS = -O3 -Wno-attributes -fno-delete-null-pointer-checks
55
CPPFLAGS = -DNDEBUG -DHAVE_UNISTD_H -DHAVE_STDARG_H -DHAVE_HIDDEN -DHAVE_MEMCPY
66
INC = -I"../../C-Sources/zlib"
77

Modelica/Resources/C-Sources/ModelicaIO.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ static int IsNumber(char* token);
178178
static void transpose(_Inout_ double* table, size_t nRow, size_t nCol) MODELICA_NONNULLATTR;
179179
/* Cycle-based in-place array transposition */
180180

181+
#pragma clang diagnostic push
182+
#pragma clang diagnostic ignored "-Wtautological-compare"
183+
181184
void ModelicaIO_readMatrixSizes(_In_z_ const char* fileName,
182185
_In_z_ const char* matrixName,
183186
_Out_ int* dim) {
@@ -1077,4 +1080,6 @@ static void transpose(_Inout_ double* table, size_t nRow, size_t nCol) {
10771080
}
10781081
}
10791082

1083+
#pragma clang diagnostic pop
1084+
10801085
#endif

Modelica/Resources/C-Sources/ModelicaStandardTables.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,9 @@ static void spline2DClose(CubicHermite2D** spline);
544544

545545
/* ----- Interface functions ----- */
546546

547+
#pragma clang diagnostic push
548+
#pragma clang diagnostic ignored "-Wtautological-compare"
549+
547550
void* ModelicaStandardTables_CombiTimeTable_init(_In_z_ const char* tableName,
548551
_In_z_ const char* fileName,
549552
_In_ double* table, size_t nRow,
@@ -5694,3 +5697,5 @@ static READ_RESULT readTable(_In_z_ const char* fileName, _In_z_ const char* tab
56945697
return NULL;
56955698
#endif /* #if !defined(NO_FILE_SYSTEM) */
56965699
}
5700+
5701+
#pragma clang diagnostic pop

0 commit comments

Comments
 (0)