Skip to content

Commit

Permalink
Silence compile-time or run-time warnings.
Browse files Browse the repository at this point in the history
See:

* https://duckduckgo.com/?q=warnings+programming&atb=v140-1&ia=web

They are a distraction at best and may indicate other issues.
  • Loading branch information
shlomif committed Jun 15, 2024
1 parent d405113 commit e8e8611
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 2 additions & 1 deletion fortune-mod/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ INCLUDE ("${CMAKE_SOURCE_DIR}/cmake/rinutils_bootstrap.cmake")
RINUTILS_SET_UP_FLAGS()

IF ("$ENV{FCS_CLANG}")
ADD_DEFINITIONS("-Weverything -Wno-language-extension-token -Wno-padded -Wno-gnu-statement-expression -Wno-unused-parameter -Wno-vla -Wno-cast-align -Wno-used-but-marked-unused -Wno-cast-qual -Wno-comma -Wno-disabled-macro-expansion -Wno-extra-semi-stmt -Wno-documentation-unknown-command -Wno-documentation -Wno-documentation-deprecated-sync -Wno-pass-failed -Wno-implicit-fallthrough")
SET (_kept_sorted_whitelists "-Wno-cast-align -Wno-cast-qual -Wno-comma -Wno-declaration-after-statement -Wno-disabled-macro-expansion -Wno-documentation -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-extra-semi-stmt -Wno-gnu-statement-expression -Wno-implicit-fallthrough -Wno-language-extension-token -Wno-padded -Wno-pass-failed -Wno-unused-parameter -Wno-used-but-marked-unused -Wno-vla")
ADD_DEFINITIONS("-Weverything ${_kept_sorted_whitelists}")
# ADD_DEFINITIONS("-Weverything")
ENDIF ()

Expand Down
9 changes: 3 additions & 6 deletions fortune-mod/fortune/fortune.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ static char *conv_pat(const char *const orig_str)
char *new_buf;

size_t cnt = 1; /* allow for '\0' */
for (sp = orig_str; *sp != '\0'; sp++)
for (sp = orig_str; *sp != '\0'; ++sp)
{
const size_t prev_cnt = cnt;
if (isalpha(*sp))
Expand Down Expand Up @@ -412,9 +412,7 @@ static void *do_malloc(const size_t size)
*/
static FILEDESC *new_fp(void)
{
FILEDESC *fp;

fp = do_malloc(sizeof *fp);
FILEDESC *const fp = do_malloc(sizeof *fp);
fp->datfd = -1;
fp->pos = POS_UNKNOWN;
fp->inf = NULL;
Expand Down Expand Up @@ -589,7 +587,6 @@ static int add_file(int percent, const char *file, const char *dir,
FILEDESC *fp;
int fd = -1;
char *path;
char *sp;
struct stat statbuf;

if (!dir)
Expand Down Expand Up @@ -1889,7 +1886,7 @@ static void free_desc(FILEDESC *ptr)
fclose(ptr->inf);
ptr->inf = NULL;
}
FILEDESC *next = ptr->next;
FILEDESC *const next = ptr->next;
free(ptr);
ptr = next;
}
Expand Down

0 comments on commit e8e8611

Please sign in to comment.