mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
Do not rely on a define for disabling warnings
Using a define to determine whether to disable warnings introduces a dependency on the header inclusion order and thus can prevent the warnings from being enabled. Fixes #1173 Change-Id: I21f5bca78a83bfe4642e9b01abd220b9fbba31a4
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Ceres Solver - A fast non-linear least squares minimizer
|
||||
// Copyright 2023 Google Inc. All rights reserved.
|
||||
// Copyright 2025 Google Inc. All rights reserved.
|
||||
// http://ceres-solver.org/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
@@ -28,10 +28,8 @@
|
||||
//
|
||||
// This file has the sole purpose to silence warnings when including Ceres.
|
||||
|
||||
// This is not your usual header guard. The macro CERES_WARNINGS_DISABLED
|
||||
// shows up again in reenable_warnings.h.
|
||||
#ifndef CERES_WARNINGS_DISABLED
|
||||
#define CERES_WARNINGS_DISABLED
|
||||
// NOTE: An include guard is not necessary and in fact counterproductive because
|
||||
// #pragma warning(push) will depend on the inclusion order.
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
@@ -40,5 +38,3 @@
|
||||
// "if you are deriving from a type in the Standard C++ Library"
|
||||
#pragma warning(disable : 4251)
|
||||
#endif
|
||||
|
||||
#endif // CERES_WARNINGS_DISABLED
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Ceres Solver - A fast non-linear least squares minimizer
|
||||
// Copyright 2023 Google Inc. All rights reserved.
|
||||
// Copyright 2025 Google Inc. All rights reserved.
|
||||
// http://ceres-solver.org/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
@@ -27,12 +27,6 @@
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
// This is not your usual header guard. See disable_warnings.h
|
||||
#ifdef CERES_WARNINGS_DISABLED
|
||||
#undef CERES_WARNINGS_DISABLED
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // CERES_WARNINGS_DISABLED
|
||||
|
||||
Reference in New Issue
Block a user