hrydgard / minitrace

Simple C/C++ library for producing JSON traces suitable for Chrome's built-in trace viewer (about:tracing).
MIT License
373 stars 64 forks source link

Extra warnings from clang #11

Closed afbjorklund closed 5 years ago

afbjorklund commented 5 years ago

When compiling a project using minitrace with clang and every warning, here are some issues found:

src/minitrace.c:122:8: error: no previous prototype for function 'mtr_time_s' [-Werror,-Wmissing-prototypes]
double mtr_time_s() {
       ^
./src/minitrace.h:53:8: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
double mtr_time_s();
       ^
                  void
src/minitrace.c:134:45: error: function 'termination_handler' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
static void termination_handler(int signum) {
                                            ^
src/minitrace.c:145:6: error: no previous prototype for function 'mtr_register_sigint_handler' [-Werror,-Wmissing-prototypes]
void mtr_register_sigint_handler() {
     ^
./src/minitrace.h:57:6: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
void mtr_register_sigint_handler();
     ^
                                 void
src/minitrace.c:171:6: error: no previous prototype for function 'mtr_shutdown' [-Werror,-Wmissing-prototypes]
void mtr_shutdown() {
     ^
./src/minitrace.h:41:6: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
void mtr_shutdown();
     ^
                  void
src/minitrace.c:207:6: error: no previous prototype for function 'mtr_start' [-Werror,-Wmissing-prototypes]
void mtr_start() {
     ^
./src/minitrace.h:46:6: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
void mtr_start();
     ^
               void
src/minitrace.c:214:6: error: no previous prototype for function 'mtr_stop' [-Werror,-Wmissing-prototypes]
void mtr_stop() {
     ^
./src/minitrace.h:47:6: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
void mtr_stop();
     ^
              void
src/minitrace.c:249:13: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
                                ((char*)raw->a_str)[700] = 0;
                                        ^
src/minitrace.c:254:3: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
                default:
                ^
src/minitrace.c:222:6: error: no previous prototype for function 'mtr_flush' [-Werror,-Wmissing-prototypes]
void mtr_flush() {
     ^
./src/minitrace.h:50:6: note: this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function
void mtr_flush();
     ^
               void
src/minitrace.c:373:10: error: enumeration value 'MTR_ARG_TYPE_NONE' not explicitly handled in switch [-Werror,-Wswitch-enum]
        switch (arg_type) {
                ^

10 errors generated.

hrydgard commented 5 years ago

Thanks!