-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
code_cleanupNo functional changes. Reformatting, reorganizing, or refactoring existing code.No functional changes. Reformatting, reorganizing, or refactoring existing code.usability
Description
The HalideRuntime.h and HalideBuffer.h header files can cause warnings to be emitted when compiled with -pedantic which can be a problem if a project is compiled with -Werror.
These are the pragmas I needed to add around the header files to avoid any warnings or errors:
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#elif defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4100) // unused formal parameter"
#pragma warning(disable : 4700) // uninitialized local variable
#pragma warning(disable : 4701) // potentially uninitialized local variable
#pragma warning(disable : 4127) // conditional expression is constant
#pragma warning(disable : 4702) // unreachable code
#endif
#include "HalideRuntime.h"
#include "HalideBuffer.h"
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning(pop)
#endif
Likewise, the halide_image_io.h caused similar problems under msvc. These are the pragmas I needed to silence those warnings:
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4100) // unreferenced formal parameter
#pragma warning(disable : 4244) // conversion from 'XXX' to 'XXX', possible loss of data
#pragma warning(disable : 4267) // 'initializing': conversion from 'XXX' to 'XXX', possible loss of data)
#pragma warning(disable : 4456) // declaration of 'XXX' hides previous local declaration
#pragma warning(disable : 4458) // declaration of 'XXX' hides class member
#pragma warning(disable : 4459) // declaration of 'XXX' hides global declaration
#pragma warning(disable : 4611) // interaction between '_setjmp' and C++ object destruction is non-portable
#pragma warning(disable : 4996) // function or variable may be unsafe.
#endif
#include "halide_image_io.h"
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
antonysigma
Metadata
Metadata
Assignees
Labels
code_cleanupNo functional changes. Reformatting, reorganizing, or refactoring existing code.No functional changes. Reformatting, reorganizing, or refactoring existing code.usability