Fix warnings

This change fixes Cosmopolitan so it has fewer opinions about compiler
warnings. The whole repository had to be cleaned up to be buildable in
-Werror -Wall mode. This lets us benefit from things like strict const
checking. Some actual bugs might have been caught too.
This commit is contained in:
Justine Tunney 2023-09-01 20:49:13 -07:00
parent e2b3c3618e
commit 0d748ad58e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
571 changed files with 1306 additions and 1888 deletions

View file

@ -28,9 +28,9 @@ extern const struct MagnumStr kSockOptnames[];
extern const struct MagnumStr kTcpOptnames[];
extern const struct MagnumStr kPollNames[];
char *DescribeMagnum(char *, const struct MagnumStr *, const char *, int);
const char *DescribeMagnum(char *, const struct MagnumStr *, const char *, int);
__funline char *GetMagnumStr(const struct MagnumStr *ms, int x) {
__funline const char *GetMagnumStr(const struct MagnumStr *ms, int x) {
int i;
for (i = 0; ms[i].x != MAGNUM_TERMINATOR; ++i) {
if (x == MAGNUM_NUMBER(ms, i)) {
@ -44,7 +44,7 @@ __funline char *GetMagnumStr(const struct MagnumStr *ms, int x) {
* Converts errno value to descriptive sentence.
* @return non-null rodata string or null if not found
*/
__funline char *_strerdoc(int x) {
__funline const char *_strerdoc(int x) {
if (x) {
return GetMagnumStr(kErrnoDocs, x);
} else {
@ -56,7 +56,7 @@ __funline char *_strerdoc(int x) {
* Converts errno value to symbolic name.
* @return non-null rodata string or null if not found
*/
__funline char *_strerrno(int x) {
__funline const char *_strerrno(int x) {
if (x) {
return GetMagnumStr(kErrnoNames, x);
} else {