Commit 4802bb57 authored by Neil Conway's avatar Neil Conway

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.
parent 175c25a4
...@@ -6,7 +6,7 @@ ...@@ -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;
......
...@@ -2,7 +2,7 @@ ...@@ -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 @@ ...@@ -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);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -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 @@ ...@@ -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);
......
...@@ -3,7 +3,7 @@ ...@@ -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;
......
...@@ -21,7 +21,7 @@ print_result(long sec, long usec, char *text) ...@@ -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;
......
...@@ -27,7 +27,7 @@ exec sql type intarray is int[AMOUNT]; ...@@ -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;
......
...@@ -16,7 +16,7 @@ exec sql declare cur cursor for ...@@ -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;
......
...@@ -9,7 +9,7 @@ exec sql type str is varchar[10]; ...@@ -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;
......
...@@ -7,7 +7,7 @@ exec sql whenever sqlerror sqlprint; ...@@ -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;
......
...@@ -14,7 +14,7 @@ struct TBempl ...@@ -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;
......
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 (?, ?)";
......
#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() ...@@ -73,7 +73,7 @@ int main()
return 0; return 0;
} }
void openit(void) static void openit(void)
{ {
$open c; $open c;
} }
......
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 ...@@ -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;
......
...@@ -70,7 +70,7 @@ int main(int argc, char *argv[]) ...@@ -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 */
......
...@@ -70,7 +70,7 @@ int main(int argc, char *argv[]) ...@@ -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 */
......
...@@ -2,7 +2,7 @@ ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment