Skip to content

Commit

Permalink
wip ~ increase warning level for cl compiles (and fix warnings)
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Apr 16, 2024
1 parent 160993d commit ec52e31
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ STRIP := $()
## /subsystem:console,4.00 :: generate "Win32 character-mode" console application; 4.00 => minimum supported system is Win9x/NT; supported only by MSVC 9 (`cl` version "15xx" from 2008) or less
## /subsystem:console,5.01 :: generate "Win32 character-mode" console application; 5.01 => minimum supported system is XP; supported by MSVC 10 (`cl` version "16xx") or later when compiling for 32-bit
## /subsystem:console,5.02 :: generate "Win32 character-mode" console application; 5.02 => minimum supported system is XP; supported by MSVC 10 (`cl` version "16xx") or later when compiling for 64-bit
CFLAGS = /nologo /W3 /WX /EHs $(call %cflags_incs,${INCLUDE_DIRS})## requires delayed expansion (b/c uses `%shell_quote` which is defined later)
CFLAGS = /nologo /W4 /WX /EHs $(call %cflags_incs,${INCLUDE_DIRS})## requires delayed expansion (b/c uses `%shell_quote` which is defined later)
%cflags_incs = $(call %map,$(eval %f=/I $(call %shell_quote,$${1}))%f,$(strip ${1}))
CFLAGS_COMPILE_ONLY := -c
CFLAGS_ARCH_32 := $(if $(filter clang-cl,${CC}),-m32,)
Expand Down
6 changes: 3 additions & 3 deletions ch.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static int ch_addbuf();
*/
static int ch_get(void)
{
struct buf *bp;
struct buf *bp = NULL;
struct bufnode *bn;
int n;
int read_again;
Expand Down Expand Up @@ -253,9 +253,9 @@ static int ch_get(void)
* If we read less than a full block, that's ok.
* We use partial block and pick up the rest next time.
*/
if (ch_ungotchar != -1)
if (ch_ungotchar > -1)
{
bp->data[bp->datasize] = ch_ungotchar;
bp->data[bp->datasize] = (char)ch_ungotchar;
n = 1;
ch_ungotchar = -1;
} else if (ch_flags & CH_HELPFILE)
Expand Down
5 changes: 1 addition & 4 deletions charset.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,7 @@ public int utf_len(int ch)
/*
* Does the parameter point to the lead byte of a well-formed UTF-8 character?
*/
public int
is_utf8_well_formed(ss, slen)
char *ss;
size_t slen;
public int is_utf8_well_formed(char *ss, size_t slen)
{
size_t i;
size_t len;
Expand Down
8 changes: 5 additions & 3 deletions cmdbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ public int cmd_char(int c)

if (!utf_mode)
{
cmd_mbc_buf[0] = c;
cmd_mbc_buf[0] = (char)c;
len = 1;
} else
{
Expand All @@ -1204,7 +1204,7 @@ public int cmd_char(int c)
{
retry:
cmd_mbc_buf_index = 1;
*cmd_mbc_buf = c;
*cmd_mbc_buf = (char)c;
if (IS_ASCII_OCTET(c))
cmd_mbc_buf_len = 1;
#if MSDOS_COMPILER || OS2
Expand All @@ -1226,7 +1226,7 @@ public int cmd_char(int c)
}
} else if (IS_UTF8_TRAIL(c))
{
cmd_mbc_buf[cmd_mbc_buf_index++] = c;
cmd_mbc_buf[cmd_mbc_buf_index++] = (char)c;
if (cmd_mbc_buf_index < cmd_mbc_buf_len)
return (CC_OK);
if (!is_utf8_well_formed(cmd_mbc_buf, cmd_mbc_buf_index))
Expand Down Expand Up @@ -1477,6 +1477,7 @@ static void read_cmdhist(void (*action)(void*,struct mlist*,char*), void *uparam

static void addhist_init(void *uparam, struct mlist *ml, char *string)
{
(void)uparam; // avoid unreferenced parameter warning
if (ml != NULL)
cmd_addhist(ml, string, 0);
else if (string != NULL)
Expand Down Expand Up @@ -1590,6 +1591,7 @@ static void copy_hist(void *uparam, struct mlist *ml, char *string)
*/
static void make_file_private(FILE *f)
{
(void)f; // avoid unreferenced parameter warning
#if HAVE_FCHMOD
int do_chmod = 1;
#if HAVE_STAT
Expand Down

0 comments on commit ec52e31

Please sign in to comment.