diff options
author | Olaf Hering <olaf@aepfle.de> | 2023-07-21 07:16:11 +0000 |
---|---|---|
committer | Olaf Hering <olaf@aepfle.de> | 2023-07-21 15:36:33 +0200 |
commit | e7af9751d9f9fd3b47911f51a5cfd08af256a9ab (patch) | |
tree | 9e166ce5ee90e0cb45f975a89c877bc4114de601 /source | |
parent | 40619cbb3bf32872df8c53cc457039229428a263 (diff) | |
download | berkeley-testfloat-3-e7af9751d9f9fd3b47911f51a5cfd08af256a9ab.zip berkeley-testfloat-3-e7af9751d9f9fd3b47911f51a5cfd08af256a9ab.tar.gz berkeley-testfloat-3-e7af9751d9f9fd3b47911f51a5cfd08af256a9ab.tar.bz2 |
In case global CFLAGS contains -Werror=return-type, compilation fails as
shown below. For some reason gcc is unable to recognize the possible
range of values in the switch statements, which can only ever be between
zero and seven.
Assist the compiler by adding a default statement. This fixes
compilation in openSUSE Tumbleweed, which adds -Werror=return-type to
global CFLAGS.
source/genCases_f64.c: In function 'f64Random':
source/genCases_f64.c:559:1: error: control reaches end of non-void function [-Werror=return-type]
source/genCases_f32.c: In function 'f32Random':
source/genCases_f32.c:417:1: error: control reaches end of non-void function [-Werror=return-type]
source/genCases_f16.c: In function 'f16Random':
source/genCases_f16.c:336:1: error: control reaches end of non-void function [-Werror=return-type]
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Diffstat (limited to 'source')
-rw-r--r-- | source/genCases_f16.c | 1 | ||||
-rw-r--r-- | source/genCases_f32.c | 1 | ||||
-rw-r--r-- | source/genCases_f64.c | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/source/genCases_f16.c b/source/genCases_f16.c index ea4c025..0155458 100644 --- a/source/genCases_f16.c +++ b/source/genCases_f16.c @@ -330,6 +330,7 @@ static float16_t f16Random( void ) case 6: return f16RandomQInfP3(); case 7: + default: return f16RandomQInfPInf(); } diff --git a/source/genCases_f32.c b/source/genCases_f32.c index 3da3a29..695d050 100644 --- a/source/genCases_f32.c +++ b/source/genCases_f32.c @@ -411,6 +411,7 @@ static float32_t f32Random( void ) case 6: return f32RandomQInfP3(); case 7: + default: return f32RandomQInfPInf(); } diff --git a/source/genCases_f64.c b/source/genCases_f64.c index 5229e89..4d74ca6 100644 --- a/source/genCases_f64.c +++ b/source/genCases_f64.c @@ -553,6 +553,7 @@ static float64_t f64Random( void ) case 6: return f64RandomQInfP3(); case 7: + default: return f64RandomQInfPInf(); } |