Warning cleanups for ecpg tests. Avoid doing pointer arithmetic on void *,

remove old-style function declarations, and mark a function "static".
There are some remaining warnings, but this fixes most of them, anyway.
This commit is contained in:
Neil Conway 2005-06-30 07:08:59 +00:00
parent 175c25a404
commit 4802bb57a6
16 changed files with 21 additions and 21 deletions

View File

@ -6,7 +6,7 @@
#include <pgtypes_interval.h> #include <pgtypes_interval.h>
int int
main() main(void)
{ {
exec sql begin declare section; exec sql begin declare section;
date date1; date date1;

View File

@ -2,7 +2,7 @@
* *
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de> * Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
* *
* $PostgreSQL: pgsql/src/interfaces/ecpg/test/dyntest.pgc,v 1.10 2003/11/29 19:52:09 pgsql Exp $ * $PostgreSQL: pgsql/src/interfaces/ecpg/test/dyntest.pgc,v 1.11 2005/06/30 07:08:59 neilc Exp $
*/ */
#include <stdio.h> #include <stdio.h>
@ -12,7 +12,7 @@
exec sql include sql3types; exec sql include sql3types;
exec sql include sqlca; exec sql include sqlca;
static void error() static void error(void)
{ printf("#%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc); { printf("#%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exit(1); exit(1);
} }

View File

@ -2,7 +2,7 @@
* *
* Copyright (c) 2000, Christof Petig <christof.petig@wtal.de> * Copyright (c) 2000, Christof Petig <christof.petig@wtal.de>
* *
* $PostgreSQL: pgsql/src/interfaces/ecpg/test/dyntest2.pgc,v 1.5 2003/11/29 19:52:09 pgsql Exp $ * $PostgreSQL: pgsql/src/interfaces/ecpg/test/dyntest2.pgc,v 1.6 2005/06/30 07:08:59 neilc Exp $
*/ */
#include <stdio.h> #include <stdio.h>
@ -11,7 +11,7 @@
exec sql include sql3types; exec sql include sql3types;
exec sql include sqlca; exec sql include sqlca;
static void error() static void error(void)
{ {
printf("\n#%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc); printf("\n#%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc);
exit(1); exit(1);

View File

@ -3,7 +3,7 @@
#include <decimal.h> #include <decimal.h>
int int
main() main(void)
{ {
char *text="error\n"; char *text="error\n";
numeric *value1, *value2, *res; numeric *value1, *value2, *res;

View File

@ -21,7 +21,7 @@ print_result(long sec, long usec, char *text)
} }
int int
main () main (void)
{ {
exec sql begin declare section; exec sql begin declare section;
long i; long i;

View File

@ -27,7 +27,7 @@ exec sql type intarray is int[AMOUNT];
typedef int intarray[AMOUNT]; typedef int intarray[AMOUNT];
int int
main () main(void)
{ {
exec sql begin declare section; exec sql begin declare section;
exec sql ifdef NAMELEN; exec sql ifdef NAMELEN;

View File

@ -16,7 +16,7 @@ exec sql declare cur cursor for
select name, born, age, married, children from meskes; select name, born, age, married, children from meskes;
int int
main () main (void)
{ {
exec sql struct birthinfo { long born; short age; }; exec sql struct birthinfo { long born; short age; };
exec sql begin declare section; exec sql begin declare section;

View File

@ -9,7 +9,7 @@ exec sql type str is varchar[10];
#include <string.h> #include <string.h>
int int
main () main (void)
{ {
exec sql begin declare section; exec sql begin declare section;
typedef struct { long born; short age; } birthinfo; typedef struct { long born; short age; } birthinfo;

View File

@ -7,7 +7,7 @@ exec sql whenever sqlerror sqlprint;
exec sql include sqlca; exec sql include sqlca;
int int
main () main (void)
{ {
EXEC SQL BEGIN DECLARE SECTION; EXEC SQL BEGIN DECLARE SECTION;
int i = 1; int i = 1;

View File

@ -14,7 +14,7 @@ struct TBempl
}; };
EXEC SQL END DECLARE SECTION; EXEC SQL END DECLARE SECTION;
int main() int main(void)
{ {
EXEC SQL BEGIN DECLARE SECTION; EXEC SQL BEGIN DECLARE SECTION;
struct TBempl empl; struct TBempl empl;

View File

@ -1,7 +1,7 @@
EXEC SQL WHENEVER SQLERROR SQLPRINT; EXEC SQL WHENEVER SQLERROR SQLPRINT;
int int
main() main(void)
{ {
EXEC SQL BEGIN DECLARE SECTION; EXEC SQL BEGIN DECLARE SECTION;
char *stmt1 = "INSERT INTO test1 VALUES (?, ?)"; char *stmt1 = "INSERT INTO test1 VALUES (?, ?)";

View File

@ -1,8 +1,8 @@
#include "sqltypes.h" #include "sqltypes.h"
void openit(void); static void openit(void);
int main() int main(void)
{ {
$int i = 14; $int i = 14;
$decimal j, m, n; $decimal j, m, n;
@ -73,7 +73,7 @@ int main()
return 0; return 0;
} }
void openit(void) static void openit(void)
{ {
$open c; $open c;
} }

View File

@ -1,6 +1,6 @@
exec sql include sqlca; exec sql include sqlca;
int fa() { return 2; } int fa(void) { return 2; }
int fb(int x) { return x; } int fb(int x) { return x; }
int fc(const char *x) { return *x; } int fc(const char *x) { return *x; }
int fd(const char *x,int i) { return (*x)*i; } int fd(const char *x,int i) { return (*x)*i; }
@ -22,7 +22,7 @@ namespace N
}; };
#endif #endif
int main() int main(void)
{ struct sa x,*y; { struct sa x,*y;
exec sql begin declare section; exec sql begin declare section;
int a=(int)2; int a=(int)2;

View File

@ -70,7 +70,7 @@ int main(int argc, char *argv[])
} }
for( n = 0; n < nthreads; n++ ) for( n = 0; n < nthreads; n++ )
{ {
pthread_create(&threads[n], NULL, test_thread, (void *)n + 1); pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
} }
/* wait for thread completion */ /* wait for thread completion */

View File

@ -70,7 +70,7 @@ int main(int argc, char *argv[])
} }
for( n = 0; n < nthreads; n++ ) for( n = 0; n < nthreads; n++ )
{ {
pthread_create(&threads[n], NULL, test_thread, (void *)n + 1); pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
} }
/* wait for thread completion */ /* wait for thread completion */

View File

@ -2,7 +2,7 @@
exec sql include sqlca; exec sql include sqlca;
#include <stdlib.h> #include <stdlib.h>
int main() int main(void)
{ {
exec sql begin declare section; exec sql begin declare section;
char **cpp=0; char **cpp=0;