diff --git a/src/autosegs.h b/src/autosegs.h index 61872610c..f62632139 100644 --- a/src/autosegs.h +++ b/src/autosegs.h @@ -35,6 +35,8 @@ #ifndef AUTOSEGS_H #define AUTOSEGS_H +#include "doomtype.h" + #define REGMARKER(x) (x) typedef void * const REGINFO; typedef void * NCREGINFO; @@ -73,11 +75,11 @@ class FAutoSegIterator } Probe = Head; } - NCREGINFO operator*() const + NCREGINFO operator*() const NO_SANITIZE { return *Probe; } - FAutoSegIterator &operator++() + FAutoSegIterator &operator++() NO_SANITIZE { do { diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index cc0a077f2..d9af4044a 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -1986,7 +1986,7 @@ END_POINTERS // //========================================================================== -static int STACK_ARGS cregcmp (const void *a, const void *b) +static int STACK_ARGS cregcmp (const void *a, const void *b) NO_SANITIZE { const PClass *class1 = *(const PClass **)a; const PClass *class2 = *(const PClass **)b; diff --git a/src/doomtype.h b/src/doomtype.h index 06541f526..0d9a13ff4 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -113,6 +113,16 @@ typedef TMap FClassMap; #define NOVTABLE #endif +#if defined(__clang__) +#if defined(__has_feature) && __has_feature(address_sanitizer)) +#define NO_SANITIZE __attribute__((no_sanitize("address"))) +#else +#define NO_SANITIZE +#endif +#else +#define NO_SANITIZE +#endif + #include "basictypes.h" // Bounding box coordinate storage. diff --git a/src/name.cpp b/src/name.cpp index 5ab361d42..359f3398c 100644 --- a/src/name.cpp +++ b/src/name.cpp @@ -182,7 +182,7 @@ void FName::NameManager::InitBuckets () // Register built-in names. 'None' must be name 0. for (size_t i = 0; i < countof(PredefinedNames); ++i) { - assert((NULL == FindName(PredefinedNames[i], true)) && "Predefined name already inserted"); + assert((0 == FindName(PredefinedNames[i], true)) && "Predefined name already inserted"); FindName (PredefinedNames[i], false); } } diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 1e1f76923..c74378f61 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -3777,7 +3777,7 @@ int P_ExecuteSpecial(int num, int arg4, int arg5) { - if (num >= 0 && num < countof(LineSpecials)) + if (num >= 0 && num < (int)countof(LineSpecials)) { return LineSpecials[num](line, activator, backSide, arg1, arg2, arg3, arg4, arg5); } diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 59bf12b39..96a0595d7 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -520,7 +520,7 @@ void R_RenderMaskedSegRange (drawseg_t *ds, int x1, int x2) wallupper[i] = mceilingclip[i]; } mceilingclip = wallupper; - } + } if (fake3D & FAKE3D_CLIPBOTTOM) { OWallMost(walllower, sclipBottom - viewz, &WallC); @@ -2763,11 +2763,6 @@ int OWallMost (short *mostbuf, fixed_t z, const FWallCoords *wallc) } #endif #endif - if (mostbuf[ix1] < 0) mostbuf[ix1] = 0; - else if (mostbuf[ix1] > viewheight) mostbuf[ix1] = (short)viewheight; - if (mostbuf[ix2-1] < 0) mostbuf[ix2-1] = 0; - else if (mostbuf[ix2-1] > viewheight) mostbuf[ix2-1] = (short)viewheight; - return bad; } @@ -2921,11 +2916,6 @@ int WallMost (short *mostbuf, const secplane_t &plane, const FWallCoords *wallc) qinterpolatedown16short (&mostbuf[ix1], ix2-ix1, y + centeryfrac,yinc); } - if (mostbuf[ix1] < 0) mostbuf[ix1] = 0; - else if (mostbuf[ix1] > viewheight) mostbuf[ix1] = (short)viewheight; - if (mostbuf[ix2-1] < 0) mostbuf[ix2-1] = 0; - else if (mostbuf[ix2-1] > viewheight) mostbuf[ix2-1] = (short)viewheight; - return bad; }