[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: clang compiler warnings
From: |
Luca Fascione |
Subject: |
Re: clang compiler warnings |
Date: |
Tue, 27 Feb 2024 05:18:33 -0800 |
On Tue, Feb 27, 2024 at 4:49 AM Werner LEMBERG <wl@gnu.org> wrote:
> According to the MacPorts log file it is the clang compiler that comes
> with XCode 15.0.1 on MaOS 14.2.1. [...] this corresponds to
>
> Apple clang version 15.0.0 (clang-1500.0.40.1)
>
> The used compiler flags are
>
> ```
> CXXFLAGS='-pipe -Os -stdlib=libc++ \
> -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk \
> -arch arm64'
> ```
>
These are not all the compilation flags for sure: at a minimum -std=c++17
(or somesuch) is required to compile inline constexpr,
so there's got to be something more going on here.
Anyways, I found out that if you use -Weverything, you get what I'd expect
from -Wall (gah).
And indeed with that I get the warning like you do with the original line
while with the cast right at the value it compiles quietly.
> Since vsize is just a typedef of size_t, would it make sense to use
> > SIZE_MAX when defined VPOS instead of a manual cast of negative one?
>
> This sounds sensible to me, since `size_t` is always unsigned...
>
I don't recommend it: if the typedef of vsize changes, SIZE_MAX won't be an
appropriate value, as it's not covariant with the definition of vsize.
This is just going from one bug today to a bug tomorrow.
L
--
Luca Fascione
- clang compiler warnings, Werner LEMBERG, 2024/02/27
- Re: clang compiler warnings, Aaron Hill, 2024/02/27
- Re: clang compiler warnings, Luca Fascione, 2024/02/27
- Re: clang compiler warnings, Dan Eble, 2024/02/27
- Re: clang compiler warnings, Luca Fascione, 2024/02/27
- Re: clang compiler warnings, Werner LEMBERG, 2024/02/27
- Re: clang compiler warnings, Luca Fascione, 2024/02/27