* alloca: somewhere later in the code, we indirectly include alloca.h which will define alloca again, include it prior to define alloca in order to not define it against. * Copy all attributes from the header to source file, and move the attributes prior to function name. cgcc is very picky on the position of attribute. Signed-off-by: Đoàn Trần Công Danh <congdanhqx@xxxxxxxxx> --- compat/regex/regex.c | 1 + compat/regex/regex_internal.c | 2 +- compat/regex/regex_internal.h | 5 ++--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compat/regex/regex.c b/compat/regex/regex.c index f3e03a9eab..4bef75a716 100644 --- a/compat/regex/regex.c +++ b/compat/regex/regex.c @@ -62,6 +62,7 @@ #include <stdint.h> #ifdef GAWK +#include <alloca.h> #undef alloca #define alloca alloca_is_bad_you_should_never_use_it #endif diff --git a/compat/regex/regex_internal.c b/compat/regex/regex_internal.c index ec51cf3446..58504f795b 100644 --- a/compat/regex/regex_internal.c +++ b/compat/regex/regex_internal.c @@ -921,7 +921,7 @@ re_string_destruct (re_string_t *pstr) /* Return the context at IDX in INPUT. */ static unsigned int -internal_function +internal_function __attribute ((pure)) re_string_context_at (const re_string_t *input, int idx, int eflags) { int c; diff --git a/compat/regex/regex_internal.h b/compat/regex/regex_internal.h index 3ee8aae59d..c61a1e4971 100644 --- a/compat/regex/regex_internal.h +++ b/compat/regex/regex_internal.h @@ -430,9 +430,8 @@ static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr) # endif /* RE_ENABLE_I18N */ static void build_upper_buffer (re_string_t *pstr) internal_function; static void re_string_translate_buffer (re_string_t *pstr) internal_function; -static unsigned int re_string_context_at (const re_string_t *input, int idx, - int eflags) - internal_function __attribute ((pure)); +static internal_function __attribute ((pure)) +unsigned int re_string_context_at (const re_string_t *input, int idx, int eflags); #endif #define re_string_peek_byte(pstr, offset) \ ((pstr)->mbs[(pstr)->cur_idx + offset]) -- 2.26.2.384.g435bf60bd5