Skip to content

Commit

Permalink
add --with-warnings flags
Browse files Browse the repository at this point in the history
  • Loading branch information
jjwilke authored and jjwilke committed Mar 18, 2020
1 parent 11e0696 commit db33757
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 30 deletions.
19 changes: 5 additions & 14 deletions Makefile.common
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_srcdir)/sprockit -I$(top_builddir)/sprockit
AM_LDFLAGS =
AM_CXXFLAGS = $(STD_CXXFLAGS) $(ERROR_CXXFLAGS)
AM_CFLAGS = $(ERROR_CFLAGS)
include $(top_srcdir)/Makefile.includes
include $(top_srcdir)/Makefile.link

AM_CXXFLAGS = $(STD_CXXFLAGS) $(ERROR_CXXFLAGS) $(WARNING_CXXFLAGS)
AM_CFLAGS = $(ERROR_CFLAGS) $(WARNING_CFLAGS)

if INTEGRATED_SST_CORE
AM_CPPFLAGS += $(SST_CPPFLAGS)
AM_CXXFLAGS += $(SST_CXXFLAGS)
endif

Expand All @@ -21,15 +21,6 @@ AM_CFLAGS += $(MACSDK_CFLAGS)
AM_CXXFLAGS += $(MACSDK_CXXFLAGS)
endif

AM_CPPFLAGS += $(PTH_CPPFLAGS)
AM_LDFLAGS += $(PTH_LDFLAGS)
AM_CPPFLAGS += $(UCONTEXT_CPPFLAGS)
AM_LDFLAGS += $(UCONTEXT_LDFLAGS)

if !DARWIN
AM_LDFLAGS += -lrt
endif

if HAVE_SST_ELEMENTS
endif

6 changes: 6 additions & 0 deletions Makefile.includes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_srcdir)/sprockit -I$(top_builddir)/sprockit
if INTEGRATED_SST_CORE
AM_CPPFLAGS += $(SST_CPPFLAGS)
endif
AM_CPPFLAGS += $(PTH_CPPFLAGS)
AM_CPPFLAGS += $(UCONTEXT_CPPFLAGS)
7 changes: 7 additions & 0 deletions Makefile.link
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
AM_LDFLAGS =
AM_LDFLAGS += $(PTH_LDFLAGS)
AM_LDFLAGS += $(UCONTEXT_LDFLAGS)

if !DARWIN
AM_LDFLAGS += -lrt
endif
39 changes: 39 additions & 0 deletions acinclude/check_warnings.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@


AH_TEMPLATE([WARNING_CFLAGS], [Contains -Werror flags])
AH_TEMPLATE([WARNING_CXXFLAGS], [Contains -Werror flags])
AC_DEFUN([CHECK_WARNINGS], [
AC_MSG_CHECKING([whether to use -Werror build])
AC_ARG_WITH(warnings,
[
AS_HELP_STRING(
[--with-warnings],
[Whether to build with certain warning flags]
)
],
[
add_warnings=$withval
],
[
add_warnings=no
]
)
AC_MSG_RESULT([$add_warnings])
if test "$add_warnings" != "no"; then
if test "$add_warnings" = "yes"; then
WARNING_CFLAGS="-Wall"
WARNING_CXXFLAGS="-Wall"
else
WARNING_CFLAGS="$withval"
WARNING_CXXFLAGS="$withval"
fi
else
WARNING_CFLAGS=""
WARNING_CXXFLAGS=""
fi
AC_SUBST(WARNING_CFLAGS)
AC_SUBST(WARNING_CXXFLAGS)
])
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ CHECK_CLANG_LLVM()

CHECK_WERROR()

CHECK_WARNINGS()


#-------------------------------------------------
# Configure subdirs
Expand Down
14 changes: 11 additions & 3 deletions tests/Makefile.clang_tests
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ CLANGTESTS = \
deglobal_ctor_cpp \
deglobal_namespace_cpp \
deglobal_array_cpp \
deglobal_lambda_cpp \
deglobal_unique_ptr_cpp \
deglobal_multi_array_cpp \
deglobal_template_cpp \
Expand Down Expand Up @@ -41,6 +40,11 @@ CLANGTESTS = \
deglobal_fxn_static_c \
deglobal_anon_c

if HAVE_CXX14
CLANGTESTS += \
deglobal_lambda_cpp
endif

# puppet_pragma_omp_parallel_cpp \
# pragma_sst_memoize_cpp \
# pragma_sst_implicit_state_cpp
Expand Down Expand Up @@ -68,7 +72,9 @@ test_clang_%_cpp.tmp-out: sst.pp.%.cc $(SSTMAC_DEGLOBAL)
-$(CXX) -std=c++11 -c $< -o tmp.o \
-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/include \
-I$(top_srcdir)/sprockit -I$(top_builddir)/sprockit \
-include sstmac/compute.h -include sstmac/skeleton.h 2>&1 /dev/null | grep error >& $@
-include sstmac/compute.h -include sstmac/skeleton.h \
-include tests/clang_src2src/remove_warnings.h \
2>&1 /dev/null | grep error >& $@
-cat $< | grep -v '^#' >> $@
-cat sstGlobals.pp.$*.cc.cpp >> $@
rm -f sstGlobals.pp.$*.cc.cpp tmp.o sst.pp.$*.cc pp.$*.cc
Expand All @@ -77,7 +83,9 @@ test_clang_%_c.tmp-out: sst.pp.%.c $(SSTMAC_DEGLOBAL)
-$(CC) -c $< -o tmp.o \
-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/include \
-I$(top_srcdir)/sprockit -I$(top_builddir)/sprockit \
-include sstmac/compute.h -include sstmac/skeleton.h 2>&1 /dev/null | grep error >& $@
-include sstmac/compute.h -include sstmac/skeleton.h \
-include tests/clang_src2src/remove_warnings.h \
2>&1 /dev/null | grep error >& $@
-cat $< | grep -v '^#' >> $@
-cat sstGlobals.pp.$*.c.cpp >> $@
rm -f sstGlobals.pp.$*.c.cpp tmp.o sst.pp.$*.c pp.$*.c
Expand Down
5 changes: 4 additions & 1 deletion tests/api/mpi/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
# For more information, see the LICENSE file in the top
# SST/macroscale directory.
#
include $(top_srcdir)/Makefile.common
include $(top_srcdir)/Makefile.includes
include $(top_srcdir)/Makefile.link

AM_CXXFLAGS = $(STD_CXXFLAGS)

AM_CPPFLAGS += \
-I$(top_srcdir)/tests/mpi/include \
Expand Down
8 changes: 0 additions & 8 deletions tests/clang_src2src/deglobal_anon.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,5 @@ void fxn()
aa.x = aa.y + b.z + cc.x;
}

static struct {
int a;
};

static struct {
} a;




2 changes: 2 additions & 0 deletions tests/clang_src2src/remove_warnings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define memcpy(...)
#define malloc(...) ((void*)0L)
4 changes: 0 additions & 4 deletions tests/reference/test_clang_deglobal_anon_c.ref-out
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ void fxn()
(*sstmac_aa).x = (*sstmac_aa).y + (*sstmac_b).z + (*sstmac_cc).x;
}}

static struct {
int a;
};

static struct a_anonymous_type{
} a;extern int __offset_xyza; void init_xyza(void* ptr){ } int __sizeof_xyza = sizeof(struct a_anonymous_type);
#include <sstmac/software/process/cppglobal.h>
Expand Down

0 comments on commit db33757

Please sign in to comment.