Skip to content

Commit ec52e31

Browse files
committed
wip ~ increase warning level for cl compiles (and fix warnings)
1 parent 160993d commit ec52e31

4 files changed

Lines changed: 10 additions & 11 deletions

File tree

Makefile.win

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ STRIP := $()
604604
## /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
605605
## /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
606606
## /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
607-
CFLAGS = /nologo /W3 /WX /EHs $(call %cflags_incs,${INCLUDE_DIRS})## requires delayed expansion (b/c uses `%shell_quote` which is defined later)
607+
CFLAGS = /nologo /W4 /WX /EHs $(call %cflags_incs,${INCLUDE_DIRS})## requires delayed expansion (b/c uses `%shell_quote` which is defined later)
608608
%cflags_incs = $(call %map,$(eval %f=/I $(call %shell_quote,$${1}))%f,$(strip ${1}))
609609
CFLAGS_COMPILE_ONLY := -c
610610
CFLAGS_ARCH_32 := $(if $(filter clang-cl,${CC}),-m32,)

ch.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static int ch_addbuf();
147147
*/
148148
static int ch_get(void)
149149
{
150-
struct buf *bp;
150+
struct buf *bp = NULL;
151151
struct bufnode *bn;
152152
int n;
153153
int read_again;
@@ -253,9 +253,9 @@ static int ch_get(void)
253253
* If we read less than a full block, that's ok.
254254
* We use partial block and pick up the rest next time.
255255
*/
256-
if (ch_ungotchar != -1)
256+
if (ch_ungotchar > -1)
257257
{
258-
bp->data[bp->datasize] = ch_ungotchar;
258+
bp->data[bp->datasize] = (char)ch_ungotchar;
259259
n = 1;
260260
ch_ungotchar = -1;
261261
} else if (ch_flags & CH_HELPFILE)

charset.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,7 @@ public int utf_len(int ch)
616616
/*
617617
* Does the parameter point to the lead byte of a well-formed UTF-8 character?
618618
*/
619-
public int
620-
is_utf8_well_formed(ss, slen)
621-
char *ss;
622-
size_t slen;
619+
public int is_utf8_well_formed(char *ss, size_t slen)
623620
{
624621
size_t i;
625622
size_t len;

cmdbuf.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ public int cmd_char(int c)
11951195

11961196
if (!utf_mode)
11971197
{
1198-
cmd_mbc_buf[0] = c;
1198+
cmd_mbc_buf[0] = (char)c;
11991199
len = 1;
12001200
} else
12011201
{
@@ -1204,7 +1204,7 @@ public int cmd_char(int c)
12041204
{
12051205
retry:
12061206
cmd_mbc_buf_index = 1;
1207-
*cmd_mbc_buf = c;
1207+
*cmd_mbc_buf = (char)c;
12081208
if (IS_ASCII_OCTET(c))
12091209
cmd_mbc_buf_len = 1;
12101210
#if MSDOS_COMPILER || OS2
@@ -1226,7 +1226,7 @@ public int cmd_char(int c)
12261226
}
12271227
} else if (IS_UTF8_TRAIL(c))
12281228
{
1229-
cmd_mbc_buf[cmd_mbc_buf_index++] = c;
1229+
cmd_mbc_buf[cmd_mbc_buf_index++] = (char)c;
12301230
if (cmd_mbc_buf_index < cmd_mbc_buf_len)
12311231
return (CC_OK);
12321232
if (!is_utf8_well_formed(cmd_mbc_buf, cmd_mbc_buf_index))
@@ -1477,6 +1477,7 @@ static void read_cmdhist(void (*action)(void*,struct mlist*,char*), void *uparam
14771477

14781478
static void addhist_init(void *uparam, struct mlist *ml, char *string)
14791479
{
1480+
(void)uparam; // avoid unreferenced parameter warning
14801481
if (ml != NULL)
14811482
cmd_addhist(ml, string, 0);
14821483
else if (string != NULL)
@@ -1590,6 +1591,7 @@ static void copy_hist(void *uparam, struct mlist *ml, char *string)
15901591
*/
15911592
static void make_file_private(FILE *f)
15921593
{
1594+
(void)f; // avoid unreferenced parameter warning
15931595
#if HAVE_FCHMOD
15941596
int do_chmod = 1;
15951597
#if HAVE_STAT

0 commit comments

Comments
 (0)