1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-18 03:46:03 +00:00

devel/kore: unbreak build with clang 3.9

src/pgsql.c:222:17: error: passing an object that undergoes default argument promotion to 'va_start'
      has undefined behavior [-Werror,-Wvarargs]
        va_start(args, count);
                       ^
src/pgsql.c:217:45: note: parameter of type 'u_int8_t' (aka 'unsigned char') is declared here
    const char *query, int result, u_int8_t count, ...)
                                            ^

PR:		214639
Reported by:	antoine (via exp-run)
Submitted by:	Tobias Kortkamp <t@tobik.me> (maintainer)
Obtained from:	upstream
This commit is contained in:
Jan Beich 2016-11-20 20:58:37 +00:00
parent 049f9a5b56
commit 46ec735372
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=426630
3 changed files with 44 additions and 2 deletions

View File

@ -4,6 +4,7 @@
PORTNAME= kore
PORTVERSION= 2.0.0
DISTVERSIONSUFFIX= -release
PORTREVISION= 1
CATEGORIES= devel www
MAINTAINER= t@tobik.me

View File

@ -0,0 +1,14 @@
--- includes/pgsql.h.orig 2016-08-01 07:59:32 UTC
+++ includes/pgsql.h
@@ -66,9 +66,9 @@ void kore_pgsql_cleanup(struct kore_pgsq
void kore_pgsql_continue(struct http_request *, struct kore_pgsql *);
int kore_pgsql_query(struct kore_pgsql *, const char *);
int kore_pgsql_query_params(struct kore_pgsql *,
- const char *, int, u_int8_t, ...);
+ const char *, int, int, ...);
int kore_pgsql_v_query_params(struct kore_pgsql *,
- const char *, int, u_int8_t, va_list);
+ const char *, int, int, va_list);
int kore_pgsql_register(const char *, const char *);
int kore_pgsql_ntuples(struct kore_pgsql *);
void kore_pgsql_logerror(struct kore_pgsql *);

View File

@ -1,4 +1,6 @@
Backport of https://github.com/jorisvink/kore/commit/c071d64bdddacbe1b69d238e14994d666a86f7cf
Backports of
https://github.com/jorisvink/kore/commit/c071d64bdddacbe1b69d238e14994d666a86f7cf
so compiling on FreeBSD 10.x/i386 succeeds. Without it the build will fail with:
src/pgsql.c:222:6: error: variable 'args' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
@ -16,9 +18,34 @@ src/pgsql.c:220:15: note: initialize the variable 'args' to silence this warning
= NULL
1 error generated.
and https://github.com/jorisvink/kore/commit/7eced6f035c83c02680d9b58371851f8662a0e8a
so that compiling with Clang 3.9 succeeds. Without it the build will fail with:
src/pgsql.c:222:17: error: passing an object that undergoes default argument promotion to 'va_start'
has undefined behavior [-Werror,-Wvarargs]
va_start(args, count);
^
src/pgsql.c:217:45: note: parameter of type 'u_int8_t' (aka 'unsigned char') is declared here
const char *query, int result, u_int8_t count, ...)
--- src/pgsql.c.orig 2016-08-01 07:59:32 UTC
+++ src/pgsql.c
@@ -219,13 +219,11 @@ kore_pgsql_query_params(struct kore_pgsq
@@ -151,7 +151,7 @@ kore_pgsql_query(struct kore_pgsql *pgsq
int
kore_pgsql_v_query_params(struct kore_pgsql *pgsql,
- const char *query, int result, u_int8_t count, va_list args)
+ const char *query, int result, int count, va_list args)
{
u_int8_t i;
char **values;
@@ -214,18 +214,16 @@ cleanup:
int
kore_pgsql_query_params(struct kore_pgsql *pgsql,
- const char *query, int result, u_int8_t count, ...)
+ const char *query, int result, int count, ...)
{
int ret;
va_list args;