From d1b5767a82889cfcd9c691131512262827059793 Mon Sep 17 00:00:00 2001 From: Yossi Gottlieb Date: Wed, 24 Feb 2021 10:10:02 +0200 Subject: [PATCH] Cleanup clang warnings. (#8546) --- src/Makefile | 5 +++++ src/lolwut5.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 3bc9f11c0..ecd69295f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -21,7 +21,12 @@ NODEPS:=clean distclean # Default settings STD=-pedantic -DREDIS_STATIC='' + +# Use -Wno-c11-extensions on clang, either where explicitly used or on +# platforms we can assume it's being used. ifneq (,$(findstring clang,$(CC))) + STD+=-Wno-c11-extensions +else ifneq (,$(findstring FreeBSD,$(uname_S))) STD+=-Wno-c11-extensions endif diff --git a/src/lolwut5.c b/src/lolwut5.c index d64e0bb27..d864888ba 100644 --- a/src/lolwut5.c +++ b/src/lolwut5.c @@ -84,9 +84,9 @@ lwCanvas *lwDrawSchotter(int console_cols, int squares_per_row, int squares_per_ * rows. */ float angle = 0; if (y > 1) { - float r1 = (float)rand() / RAND_MAX / squares_per_col * y; - float r2 = (float)rand() / RAND_MAX / squares_per_col * y; - float r3 = (float)rand() / RAND_MAX / squares_per_col * y; + float r1 = (float)rand() / (float) RAND_MAX / squares_per_col * y; + float r2 = (float)rand() / (float) RAND_MAX / squares_per_col * y; + float r3 = (float)rand() / (float) RAND_MAX / squares_per_col * y; if (rand() % 2) r1 = -r1; if (rand() % 2) r2 = -r2; if (rand() % 2) r3 = -r3;