Skip to content
This repository has been archived by the owner on Jul 29, 2020. It is now read-only.

Commit

Permalink
jas_math.h: suppress -Wshift-negative-value in assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann authored and jubalh committed Jun 17, 2020
1 parent 27d5a88 commit 681296e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/libjasper/include/jasper/jas_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ extern "C" {
*
\******************************************************************************/

#ifdef __clang__
/* suppress clang warning "shifting a negative signed value is
undefined" in the assertions below */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshift-negative-value"
#endif

JAS_ATTRIBUTE_DISABLE_USAN
inline static int jas_int_asr(int x, int n)
{
Expand Down Expand Up @@ -173,6 +180,10 @@ inline static int jas_fast32_asl(int_fast32_t x, int n)
return x << n;
}

#ifdef __clang__
#pragma GCC diagnostic pop
#endif

/******************************************************************************\
* Safe integer arithmetic (i.e., with overflow checking).
\******************************************************************************/
Expand Down

0 comments on commit 681296e

Please sign in to comment.