Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple warnings if add more compiler's flags #8

Open
dennisrazumovsky opened this issue Mar 30, 2024 · 0 comments
Open

Multiple warnings if add more compiler's flags #8

dennisrazumovsky opened this issue Mar 30, 2024 · 0 comments

Comments

@dennisrazumovsky
Copy link

dennisrazumovsky commented Mar 30, 2024

% 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);
      |   
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant