efl src - mark fallthrough switch statements in 3rd party code

in code we importend that doesnt use eina we have warnings of
fallthroughs. all o them are commented to be fallthrough so add the
attribute there too to have fewer warnings.
This commit is contained in:
Carsten Haitzler 2017-08-04 10:10:12 +09:00
parent 12278d27de
commit 932ae95a4e
3 changed files with 41 additions and 4 deletions

View File

@ -3136,7 +3136,13 @@ get_directive_token(cpp_reader * pfile)
case CPP_POP: case CPP_POP:
if (!CPP_IS_MACRO_BUFFER(CPP_BUFFER(pfile))) if (!CPP_IS_MACRO_BUFFER(CPP_BUFFER(pfile)))
return token; return token;
/* ... else fall though ... */ #ifndef __has_attribute
# define __has_attribute(x) 0
#endif
#if __has_attribute(fallthrough)
__attribute__((fallthrough));
#endif
/* ... else fall though ... */
case CPP_HSPACE: case CPP_HSPACE:
case CPP_COMMENT: case CPP_COMMENT:
CPP_SET_WRITTEN(pfile, old_written); CPP_SET_WRITTEN(pfile, old_written);
@ -4300,6 +4306,12 @@ skip_if_group(cpp_reader * pfile, int any)
validate_else(pfile, validate_else(pfile,
kt->type == kt->type ==
T_ELSE ? "#else" : "#endif"); T_ELSE ? "#else" : "#endif");
#ifndef __has_attribute
# define __has_attribute(x) 0
#endif
#if __has_attribute(fallthrough)
__attribute__((fallthrough));
#endif
/* this fall through is intened */ /* this fall through is intened */
case T_ELIF: case T_ELIF:
if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack) if (pfile->if_stack == CPP_BUFFER(pfile)->if_stack)
@ -6748,7 +6760,14 @@ cpp_handle_options(cpp_reader * pfile, int argc, char **argv)
{ {
opts->out_fname = ""; opts->out_fname = "";
break; break;
} /* else fall through into error */ }
#ifndef __has_attribute
# define __has_attribute(x) 0
#endif
#if __has_attribute(fallthrough)
__attribute__((fallthrough));
#endif
/* else fall through into error */
default: default:
return i; return i;
} }

View File

@ -2119,6 +2119,12 @@ http_parser_parse_url(const char *buf, size_t buflen, int is_connect,
case s_req_server_with_at: case s_req_server_with_at:
found_at = 1; found_at = 1;
#ifndef __has_attribute
# define __has_attribute(x) 0
#endif
#if __has_attribute(fallthrough)
__attribute__((fallthrough));
#endif
/* FALLTROUGH */ /* FALLTROUGH */
case s_req_server: case s_req_server:
uf = UF_HOST; uf = UF_HOST;

View File

@ -210,7 +210,13 @@ static void set_wordbreaks(
posLast = posCur; posLast = posCur;
break; break;
} }
/* Fall off */ #ifndef __has_attribute
# define __has_attribute(x) 0
#endif
#if __has_attribute(fallthrough)
__attribute__((fallthrough));
#endif
/* Fall off */
case WBP_Newline: case WBP_Newline:
/* WB3a,3b */ /* WB3a,3b */
@ -323,7 +329,13 @@ static void set_wordbreaks(
wbcSeqStart = wbcCur; wbcSeqStart = wbcCur;
posLast = posCur; posLast = posCur;
} }
/* No break on purpose */ #ifndef __has_attribute
# define __has_attribute(x) 0
#endif
#if __has_attribute(fallthrough)
__attribute__((fallthrough));
#endif
/* No break on purpose */
case WBP_MidNumLet: case WBP_MidNumLet:
if (((wbcLast == WBP_ALetter) || if (((wbcLast == WBP_ALetter) ||
(wbcLast == WBP_Hebrew_Letter)) || /* WB6,7 */ (wbcLast == WBP_Hebrew_Letter)) || /* WB6,7 */