gnosek / fcgiwrap

Simple FastCGI wrapper for CGI scripts
http://nginx.localdomain.pl/
MIT License
407 stars 134 forks source link

fcgiwrap.c:581:4: error: this statement may fall through [-Werror=implicit-fallthrough=] #50

Closed joshuaalayon closed 4 years ago

joshuaalayon commented 4 years ago

Centos 8

During the step "make" I run into this error:

cc -std=gnu99 -Wall -Wextra -Werror -pedantic -O2 -g3    fcgiwrap.c  -lfcgi  -o fcgiwrap
fcgiwrap.c: In function ‘handle_fcgi_request’:
fcgiwrap.c:581:4: error: this statement may fall through [-Werror=implicit-fallthrough=]
    cgi_error("502 Bad Gateway", "Cannot execute script", filename);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fcgiwrap.c:583:3: note: here
   default: /* parent */
   ^~~~~~~

Any ideas? I tried removing -Wall, -Wextra, -Werror but the install didn't work and I can't help but feel this is why.

Lekensteyn commented 4 years ago

Try adding __attribute__((__noreturn__)) to static void cgi_error(const char *message, const char *reason, const char *filename):

static void cgi_error(const char *message, const char *reason, const char *filename)
__attribute__((__noreturn__))
{

That function calls _Exit and will never return, but GCC thinks otherwise due to lack of the annotation.

joshuaalayon commented 4 years ago

I ended up solving this by using this command to install fcgiwrap in Centos 8:

dnf --enablerepo=epel -y install fcgiwrap

Not as elegant as I wanted but it's doing the job, lol