From 4802bb57a6d5331f32bc14bb196e397021fece1c Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Thu, 30 Jun 2005 07:08:59 +0000 Subject: [PATCH] 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. --- src/interfaces/ecpg/test/dt_test.pgc | 2 +- src/interfaces/ecpg/test/dyntest.pgc | 4 ++-- src/interfaces/ecpg/test/dyntest2.pgc | 4 ++-- src/interfaces/ecpg/test/num_test.pgc | 2 +- src/interfaces/ecpg/test/perftest.pgc | 2 +- src/interfaces/ecpg/test/test1.pgc | 2 +- src/interfaces/ecpg/test/test2.pgc | 2 +- src/interfaces/ecpg/test/test3.pgc | 2 +- src/interfaces/ecpg/test/test4.pgc | 2 +- src/interfaces/ecpg/test/test5.pgc | 2 +- src/interfaces/ecpg/test/test_desc.pgc | 2 +- src/interfaces/ecpg/test/test_informix.pgc | 6 +++--- src/interfaces/ecpg/test/test_init.pgc | 4 ++-- src/interfaces/ecpg/test/test_thread.pgc | 2 +- src/interfaces/ecpg/test/test_thread_implicit.pgc | 2 +- src/interfaces/ecpg/test/testdynalloc.pgc | 2 +- 16 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/interfaces/ecpg/test/dt_test.pgc b/src/interfaces/ecpg/test/dt_test.pgc index 0e509925b1..cdd257f7fb 100644 --- a/src/interfaces/ecpg/test/dt_test.pgc +++ b/src/interfaces/ecpg/test/dt_test.pgc @@ -6,7 +6,7 @@ #include int -main() +main(void) { exec sql begin declare section; date date1; diff --git a/src/interfaces/ecpg/test/dyntest.pgc b/src/interfaces/ecpg/test/dyntest.pgc index 987e248b4f..00b87d5801 100644 --- a/src/interfaces/ecpg/test/dyntest.pgc +++ b/src/interfaces/ecpg/test/dyntest.pgc @@ -2,7 +2,7 @@ * * Copyright (c) 2000, Christof Petig * - * $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 @@ -12,7 +12,7 @@ exec sql include sql3types; exec sql include sqlca; -static void error() +static void error(void) { printf("#%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc); exit(1); } diff --git a/src/interfaces/ecpg/test/dyntest2.pgc b/src/interfaces/ecpg/test/dyntest2.pgc index c7128648e8..06241c8ae8 100644 --- a/src/interfaces/ecpg/test/dyntest2.pgc +++ b/src/interfaces/ecpg/test/dyntest2.pgc @@ -2,7 +2,7 @@ * * Copyright (c) 2000, Christof Petig * - * $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 @@ -11,7 +11,7 @@ exec sql include sql3types; exec sql include sqlca; -static void error() +static void error(void) { printf("\n#%ld:%s\n",sqlca.sqlcode,sqlca.sqlerrm.sqlerrmc); exit(1); diff --git a/src/interfaces/ecpg/test/num_test.pgc b/src/interfaces/ecpg/test/num_test.pgc index 03de51e0cc..f3991ccc8a 100644 --- a/src/interfaces/ecpg/test/num_test.pgc +++ b/src/interfaces/ecpg/test/num_test.pgc @@ -3,7 +3,7 @@ #include int -main() +main(void) { char *text="error\n"; numeric *value1, *value2, *res; diff --git a/src/interfaces/ecpg/test/perftest.pgc b/src/interfaces/ecpg/test/perftest.pgc index 3bd4982eef..0c5b1478aa 100644 --- a/src/interfaces/ecpg/test/perftest.pgc +++ b/src/interfaces/ecpg/test/perftest.pgc @@ -21,7 +21,7 @@ print_result(long sec, long usec, char *text) } int -main () +main (void) { exec sql begin declare section; long i; diff --git a/src/interfaces/ecpg/test/test1.pgc b/src/interfaces/ecpg/test/test1.pgc index 753c0abae5..9f784ac799 100644 --- a/src/interfaces/ecpg/test/test1.pgc +++ b/src/interfaces/ecpg/test/test1.pgc @@ -27,7 +27,7 @@ exec sql type intarray is int[AMOUNT]; typedef int intarray[AMOUNT]; int -main () +main(void) { exec sql begin declare section; exec sql ifdef NAMELEN; diff --git a/src/interfaces/ecpg/test/test2.pgc b/src/interfaces/ecpg/test/test2.pgc index f16eb0921e..c5640baea4 100644 --- a/src/interfaces/ecpg/test/test2.pgc +++ b/src/interfaces/ecpg/test/test2.pgc @@ -16,7 +16,7 @@ exec sql declare cur cursor for select name, born, age, married, children from meskes; int -main () +main (void) { exec sql struct birthinfo { long born; short age; }; exec sql begin declare section; diff --git a/src/interfaces/ecpg/test/test3.pgc b/src/interfaces/ecpg/test/test3.pgc index 46e9d4904a..0d2a76e47b 100644 --- a/src/interfaces/ecpg/test/test3.pgc +++ b/src/interfaces/ecpg/test/test3.pgc @@ -9,7 +9,7 @@ exec sql type str is varchar[10]; #include int -main () +main (void) { exec sql begin declare section; typedef struct { long born; short age; } birthinfo; diff --git a/src/interfaces/ecpg/test/test4.pgc b/src/interfaces/ecpg/test/test4.pgc index 8d58af2817..3e5fae096d 100644 --- a/src/interfaces/ecpg/test/test4.pgc +++ b/src/interfaces/ecpg/test/test4.pgc @@ -7,7 +7,7 @@ exec sql whenever sqlerror sqlprint; exec sql include sqlca; int -main () +main (void) { EXEC SQL BEGIN DECLARE SECTION; int i = 1; diff --git a/src/interfaces/ecpg/test/test5.pgc b/src/interfaces/ecpg/test/test5.pgc index 928b3f2a57..18e5b48971 100644 --- a/src/interfaces/ecpg/test/test5.pgc +++ b/src/interfaces/ecpg/test/test5.pgc @@ -14,7 +14,7 @@ struct TBempl }; EXEC SQL END DECLARE SECTION; -int main() +int main(void) { EXEC SQL BEGIN DECLARE SECTION; struct TBempl empl; diff --git a/src/interfaces/ecpg/test/test_desc.pgc b/src/interfaces/ecpg/test/test_desc.pgc index 7d4854cfdf..6d70a6496c 100644 --- a/src/interfaces/ecpg/test/test_desc.pgc +++ b/src/interfaces/ecpg/test/test_desc.pgc @@ -1,7 +1,7 @@ EXEC SQL WHENEVER SQLERROR SQLPRINT; int -main() +main(void) { EXEC SQL BEGIN DECLARE SECTION; char *stmt1 = "INSERT INTO test1 VALUES (?, ?)"; diff --git a/src/interfaces/ecpg/test/test_informix.pgc b/src/interfaces/ecpg/test/test_informix.pgc index ce4977fed2..1c27c6e7a8 100644 --- a/src/interfaces/ecpg/test/test_informix.pgc +++ b/src/interfaces/ecpg/test/test_informix.pgc @@ -1,8 +1,8 @@ #include "sqltypes.h" -void openit(void); +static void openit(void); -int main() +int main(void) { $int i = 14; $decimal j, m, n; @@ -73,7 +73,7 @@ int main() return 0; } -void openit(void) +static void openit(void) { $open c; } diff --git a/src/interfaces/ecpg/test/test_init.pgc b/src/interfaces/ecpg/test/test_init.pgc index d5c7e74966..29b14b20bd 100644 --- a/src/interfaces/ecpg/test/test_init.pgc +++ b/src/interfaces/ecpg/test/test_init.pgc @@ -1,6 +1,6 @@ exec sql include sqlca; -int fa() { return 2; } +int fa(void) { return 2; } int fb(int x) { return x; } int fc(const char *x) { return *x; } int fd(const char *x,int i) { return (*x)*i; } @@ -22,7 +22,7 @@ namespace N }; #endif -int main() +int main(void) { struct sa x,*y; exec sql begin declare section; int a=(int)2; diff --git a/src/interfaces/ecpg/test/test_thread.pgc b/src/interfaces/ecpg/test/test_thread.pgc index 46a371a6f8..bf977cc937 100644 --- a/src/interfaces/ecpg/test/test_thread.pgc +++ b/src/interfaces/ecpg/test/test_thread.pgc @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) } 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 */ diff --git a/src/interfaces/ecpg/test/test_thread_implicit.pgc b/src/interfaces/ecpg/test/test_thread_implicit.pgc index 367290d8ea..475afaa600 100644 --- a/src/interfaces/ecpg/test/test_thread_implicit.pgc +++ b/src/interfaces/ecpg/test/test_thread_implicit.pgc @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) } 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 */ diff --git a/src/interfaces/ecpg/test/testdynalloc.pgc b/src/interfaces/ecpg/test/testdynalloc.pgc index a2f67412b7..a859b5f810 100644 --- a/src/interfaces/ecpg/test/testdynalloc.pgc +++ b/src/interfaces/ecpg/test/testdynalloc.pgc @@ -2,7 +2,7 @@ exec sql include sqlca; #include -int main() +int main(void) { exec sql begin declare section; char **cpp=0; -- 2.40.0