Commit e1201d73 authored by Mark Olesen's avatar Mark Olesen
Browse files

COMP: sign check to avoid warnings about new[] range

parent 9aea491e
......@@ -50,6 +50,7 @@ void Foam::List<T>::doResize(const label newSize)
{
if (newSize > 0)
{
// With sign-check to avoid spurious -Walloc-size-larger-than
T* nv = new T[newSize];
const label overlap = min(this->size_, newSize);
......
......@@ -31,8 +31,9 @@ License
template<class T>
inline void Foam::List<T>::doAlloc()
{
if (this->size_)
if (this->size_ > 0)
{
// With sign-check to avoid spurious -Walloc-size-larger-than
this->v_ = new T[this->size_];
}
}
......
......@@ -35,8 +35,9 @@ inline void Foam::Matrix<Form, Type>::doAlloc()
{
const label len = size();
if (len)
if (len > 0)
{
// With sign-check to avoid spurious -Walloc-size-larger-than
v_ = new Type[len];
}
}
......
......@@ -9,7 +9,7 @@ include $(RULES)/c++$(WM_COMPILE_OPTION)
c++FLAGS = $(c++ARCH) $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS)
Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -Wno-alloc-size-larger-than -c $< -o $@
Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $< -o $@
cxxtoo = $(Ctoo)
cctoo = $(Ctoo)
cpptoo = $(Ctoo)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment