Skip to content

Commit

Permalink
Regards mpaland#123: Suppressing the spurious "uninitialized" warning…
Browse files Browse the repository at this point in the history
… in older versions of GCC.
  • Loading branch information
eyalroz committed Oct 17, 2022
1 parent 9624be7 commit 77c56db
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/printf/printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,15 @@ static double apply_scaling(double num, struct scaling_factor normalization)

static double unapply_scaling(double normalized, struct scaling_factor normalization)
{
#ifdef __GNUC__
// accounting for a static analysis bug in GCC 6.x and earlier
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
return normalization.multiply ? normalized / normalization.raw_factor : normalized * normalization.raw_factor;
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
}

static struct scaling_factor update_normalization(struct scaling_factor sf, double extra_multiplicative_factor)
Expand Down

0 comments on commit 77c56db

Please sign in to comment.