Skip to content

Commit 6cbb235

Browse files
committed
Tweak recently-added tests to suppress scary-looking warnings on 64-bit
machines about casts between pointers and integers of different sizes. While they're harmless, we shouldn't expect users to have to go through and figure that out for themselves.
1 parent 2b0e46e commit 6cbb235

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

src/interfaces/ecpg/test/expected/thread-alloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static void* fn(void* arg)
145145
#line 42 "alloc.pgc"
146146

147147

148-
value = (int)arg;
148+
value = (long)arg;
149149
sprintf(name, "Connection: %d", value);
150150

151151
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , name, 0);
@@ -207,7 +207,7 @@ int main (int argc, char** argv)
207207
CloseHandle(threads[i]);
208208
#else
209209
for (i = 0; i < THREADS; ++i)
210-
pthread_create(&threads[i], NULL, fn, (void*)i);
210+
pthread_create(&threads[i], NULL, fn, (void *) (long) i);
211211
for (i = 0; i < THREADS; ++i)
212212
pthread_join(threads[i], NULL);
213213
#endif

src/interfaces/ecpg/test/expected/thread-prep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static void* fn(void* arg)
145145
#line 42 "prep.pgc"
146146

147147

148-
value = (int)arg;
148+
value = (long)arg;
149149
sprintf(name, "Connection: %d", value);
150150

151151
{ ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , name, 0);
@@ -245,7 +245,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
245245
CloseHandle(threads[i]);
246246
#else
247247
for (i = 0; i < THREADS; ++i)
248-
pthread_create(&threads[i], NULL, fn, (void*)i);
248+
pthread_create(&threads[i], NULL, fn, (void *) (long) i);
249249
for (i = 0; i < THREADS; ++i)
250250
pthread_join(threads[i], NULL);
251251
#endif

src/interfaces/ecpg/test/expected/thread-thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
9696
for( n = 0; n < nthreads; n++ )
9797
{
9898
#ifndef WIN32
99-
pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
99+
pthread_create(&threads[n], NULL, test_thread, (void *) (long) (n + 1));
100100
#else
101101
threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)test_thread, (void *) (n + 1), 0, NULL);
102102
#endif

src/interfaces/ecpg/test/expected/thread-thread_implicit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ int main(int argc, char *argv[])
9797
for( n = 0; n < nthreads; n++ )
9898
{
9999
#ifndef WIN32
100-
pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
100+
pthread_create(&threads[n], NULL, test_thread, (void *) (long) (n + 1));
101101
#else
102102
threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) test_thread, (void *) (n+1), 0, NULL);
103103
#endif

src/interfaces/ecpg/test/thread/alloc.pgc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static void* fn(void* arg)
4141
char **r = NULL;
4242
EXEC SQL END DECLARE SECTION;
4343

44-
value = (int)arg;
44+
value = (long)arg;
4545
sprintf(name, "Connection: %d", value);
4646

4747
EXEC SQL CONNECT TO REGRESSDB1 AS :name;
@@ -78,7 +78,7 @@ int main (int argc, char** argv)
7878
CloseHandle(threads[i]);
7979
#else
8080
for (i = 0; i < THREADS; ++i)
81-
pthread_create(&threads[i], NULL, fn, (void*)i);
81+
pthread_create(&threads[i], NULL, fn, (void *) (long) i);
8282
for (i = 0; i < THREADS; ++i)
8383
pthread_join(threads[i], NULL);
8484
#endif

src/interfaces/ecpg/test/thread/prep.pgc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static void* fn(void* arg)
4141
char query[256] = "INSERT INTO T VALUES ( ? )";
4242
EXEC SQL END DECLARE SECTION;
4343

44-
value = (int)arg;
44+
value = (long)arg;
4545
sprintf(name, "Connection: %d", value);
4646

4747
EXEC SQL CONNECT TO REGRESSDB1 AS :name;
@@ -84,7 +84,7 @@ int main (int argc, char** argv)
8484
CloseHandle(threads[i]);
8585
#else
8686
for (i = 0; i < THREADS; ++i)
87-
pthread_create(&threads[i], NULL, fn, (void*)i);
87+
pthread_create(&threads[i], NULL, fn, (void *) (long) i);
8888
for (i = 0; i < THREADS; ++i)
8989
pthread_join(threads[i], NULL);
9090
#endif

src/interfaces/ecpg/test/thread/thread.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
6464
for( n = 0; n < nthreads; n++ )
6565
{
6666
#ifndef WIN32
67-
pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
67+
pthread_create(&threads[n], NULL, test_thread, (void *) (long) (n + 1));
6868
#else
6969
threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)test_thread, (void *) (n + 1), 0, NULL);
7070
#endif

src/interfaces/ecpg/test/thread/thread_implicit.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
6565
for( n = 0; n < nthreads; n++ )
6666
{
6767
#ifndef WIN32
68-
pthread_create(&threads[n], NULL, test_thread, (void *) (n + 1));
68+
pthread_create(&threads[n], NULL, test_thread, (void *) (long) (n + 1));
6969
#else
7070
threads[n] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) test_thread, (void *) (n+1), 0, NULL);
7171
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy