Skip to content

Multiple warnings if add more compiler's flags #8

@dennisrazumovsky

Description

@dennisrazumovsky
% cat ./Makefile 
WFLAGS += -Wall -Wextra -Wpedantic -Wshadow
WFLAGS += -Wconversion -Wsign-conversion -Winit-self -Wunreachable-code -Wformat-y2k
WFLAGS += -Wformat-nonliteral -Wformat-security -Wmissing-include-dirs
WFLAGS += -Wswitch-default -Wtrigraphs -Wstrict-overflow=5
WFLAGS += -Wfloat-equal -Wundef -Wshadow
WFLAGS += -Wbad-function-cast -Wcast-qual -Wcast-align
WFLAGS += -Wwrite-strings
WFLAGS += -Winline

all:
	gcc -g $(WFLAGS) csv.c split.c fread_csv_line.c tests/test.c -o test
make

csv.c: In function ‘parse_csv’:
csv.c:61:33: warning: conversion to ‘long unsigned int’ from ‘int’ may change the sign of the result [-Wsign-conversion]
   61 |     buf = malloc( sizeof(char*) * (fieldcnt+1) );
      |                                 ^
csv.c:102:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
  102 |                 fEnd = 1;
      |                 ~~~~~^~~
csv.c:103:13: note: here
  103 |             case ',':
      |             ^~~~
split.c: In function ‘split_on_unescaped_newlines’:
split.c:27:33: warning: conversion to ‘long unsigned int’ from ‘int’ may change the sign of the result [-Wsign-conversion]
   27 |     buf = malloc( sizeof(char*) * (nLines+1) );
      |                                 ^
split.c:48:26: warning: conversion to ‘size_t’ {aka ‘long unsigned int’} from ‘long int’ may change the sign of the result [-Wsign-conversion]
   48 |             size_t len = ptr - lineStart;
      |                          ^~~
fread_csv_line.c: In function ‘fread_csv_line’:
fread_csv_line.c:57:37: warning: conversion to ‘size_t’ {aka ‘long unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
   57 |         buf = malloc( max_line_size + 1 );
      |                       ~~~~~~~~~~~~~~^~~
fread_csv_line.c:11:21: warning: conversion from ‘size_t’ {aka ‘long unsigned int’} to ‘int’ may change value [-Wconversion]
   11 |         fread_len = fread( read_buf, sizeof(char), READ_BLOCK_SIZE, fp );\
      |                     ^~~~~
fread_csv_line.c:74:9: note: in expansion of macro ‘QUICK_GETC’
   74 |         QUICK_GETC(ch, fp);
      |         ^~~~~~~~~~
fread_csv_line.c:11:21: warning: conversion from ‘size_t’ {aka ‘long unsigned int’} to ‘int’ may change value [-Wconversion]
   11 |         fread_len = fread( read_buf, sizeof(char), READ_BLOCK_SIZE, fp );\
      |                     ^~~~~
fread_csv_line.c:89:17: note: in expansion of macro ‘QUICK_GETC’
   89 |                 QUICK_GETC(ch, fp);
      |   

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions