Skip to content

Commit

Permalink
Merge pull request InsightSoftwareConsortium#4681 from andrei-sandor/…
Browse files Browse the repository at this point in the history
…WwarningsSupressedNullptr

COMP: Fix zero as null pointer constant
  • Loading branch information
thewtex authored May 20, 2024
2 parents ea7b1ab + f39300c commit 5279be5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions Modules/Core/Common/test/itkSmartPointerGTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,34 @@ TEST(SmartPointer, EmptyAndNull)
cptr = nullptr;
EXPECT_TRUE(cptr.IsNull());

#if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wzero-as-null-pointer-constant")
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
# endif
#endif
// NOLINTNEXTLINE(modernize-use-nullptr)
ptr = NULL; // Do not change NULL, null, Null in this file. This file intentionally contains usage of legacy NULL
#if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wzero-as-null-pointer-constant")
# pragma clang diagnostic pop
# endif
#endif
EXPECT_TRUE(ptr.IsNull());

#if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wzero-as-null-pointer-constant")
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
# endif
#endif
// NOLINTNEXTLINE(modernize-use-nullptr)
cptr = NULL; // Do not change NULL, null, Null in this file. This file intentionally contains usage of legacy NULL
#if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wzero-as-null-pointer-constant")
# pragma clang diagnostic pop
# endif
#endif
EXPECT_TRUE(cptr.IsNull());


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
using FrontIterator = QuadEdgeMeshFrontIterator<MeshTypeArg, QEPrimalType>; \
using ConstFrontIterator = QuadEdgeMeshConstFrontIterator<MeshTypeArg, QEPrimalType>; \
\
virtual FrontIterator BeginFront(QEPrimalType * seed = (QEPrimalType *)0) \
virtual FrontIterator BeginFront(QEPrimalType * seed = (QEPrimalType *)nullptr) \
{ \
return (FrontIterator(this, true, seed)); \
} \
Expand Down

0 comments on commit 5279be5

Please sign in to comment.