Cygwin: testsuite: Fix compilation warnings

Fix the warnings the previous change surfaces.

See ltp commit d5c2112f for mmap fixes.
This commit is contained in:
Jon Turney 2022-08-30 14:22:55 +01:00
parent daeeaa97b3
commit 01a0e3e491
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
14 changed files with 40 additions and 40 deletions

View File

@ -210,7 +210,7 @@ extern void STD_opts_help();
* SCALL = system call and parameters to execute * SCALL = system call and parameters to execute
* *
***********************************************************************/ ***********************************************************************/
#define TEST(SCALL) TEST_RETURN = SCALL; TEST_ERRNO=errno; #define TEST(SCALL) TEST_RETURN = (long) SCALL; TEST_ERRNO=errno;
/*********************************************************************** /***********************************************************************
* TEST_VOID: calls a system call * TEST_VOID: calls a system call

View File

@ -130,7 +130,7 @@ int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */
int pid; /* process id from fork */ int pid; /* process id from fork */
int status; /* status returned from waitpid */ int status; /* status returned from waitpid */
const char * const args[2]={"/usr/bin/test", 0}; /* argument list for execv call */ char * const args[2]={"/usr/bin/test", 0}; /* argument list for execv call */
int int
main(int ac, char **av) main(int ac, char **av)

View File

@ -133,7 +133,7 @@ int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */
int pid; /* process id from fork */ int pid; /* process id from fork */
int status; /* status returned from waitpid */ int status; /* status returned from waitpid */
const char *const args[2]={"/usr/bin/test", 0}; /* argument list for execve call */ char *const args[2]={"/usr/bin/test", 0}; /* argument list for execve call */
extern char **environ; /* pointer to this processes env, to pass along */ extern char **environ; /* pointer to this processes env, to pass along */
int int

View File

@ -133,7 +133,7 @@ int exp_enos[]={0, 0}; /* Zero terminated list of expected errnos */
int pid; /* process id from fork */ int pid; /* process id from fork */
int status; /* status returned from waitpid */ int status; /* status returned from waitpid */
const char *const args[2]={"/usr/bin/test", 0}; /* argument list for execvp call */ char *const args[2]={"/usr/bin/test", 0}; /* argument list for execvp call */
int int
main(int ac, char **av) main(int ac, char **av)

View File

@ -118,11 +118,12 @@ main(int ac, char **av)
* Call mmap to map the temporary file 'TEMPFILE' * Call mmap to map the temporary file 'TEMPFILE'
* with read access. * with read access.
*/ */
TEST(mmap(0, page_sz, PROT_READ, errno = 0;
MAP_FILE|MAP_SHARED, fildes, 0)); addr = mmap(0, page_sz, PROT_READ,
MAP_FILE|MAP_SHARED, fildes, 0);
/* Check for the return value of mmap() */ /* Check for the return value of mmap() */
if (TEST_RETURN == (int)MAP_FAILED) { if (addr == MAP_FAILED) {
tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s", tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s",
TEMPFILE, errno, strerror(errno)); TEMPFILE, errno, strerror(errno));
continue; continue;
@ -132,9 +133,6 @@ main(int ac, char **av)
* executed without (-f) option. * executed without (-f) option.
*/ */
if (STD_FUNCTIONAL_TEST) { if (STD_FUNCTIONAL_TEST) {
/* Get the mmap return value */
addr = (char *)TEST_RETURN;
/* /*
* Read the file contents into the dummy * Read the file contents into the dummy
* string. * string.

View File

@ -121,11 +121,12 @@ main(int ac, char **av)
* Call mmap to map the temporary file 'TEMPFILE' * Call mmap to map the temporary file 'TEMPFILE'
* with execute access. * with execute access.
*/ */
TEST(mmap(0, page_sz, PROT_EXEC, errno = 0;
MAP_FILE|MAP_SHARED, fildes, 0)); addr = mmap(0, page_sz, PROT_EXEC,
MAP_FILE|MAP_SHARED, fildes, 0);
/* Check for the return value of mmap() */ /* Check for the return value of mmap() */
if (TEST_RETURN == (int)MAP_FAILED) { if (addr == MAP_FAILED) {
tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s", tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s",
TEMPFILE, errno, strerror(errno)); TEMPFILE, errno, strerror(errno));
continue; continue;
@ -135,9 +136,6 @@ main(int ac, char **av)
* executed without (-f) option. * executed without (-f) option.
*/ */
if (STD_FUNCTIONAL_TEST) { if (STD_FUNCTIONAL_TEST) {
/* Get the mmap return value */
addr = (char *)TEST_RETURN;
/* /*
* Read the file contents into the dummy * Read the file contents into the dummy
* variable. * variable.

View File

@ -121,11 +121,12 @@ main(int ac, char **av)
* Call mmap to map the temporary file 'TEMPFILE' * Call mmap to map the temporary file 'TEMPFILE'
* with read and execute access. * with read and execute access.
*/ */
TEST(mmap(0, page_sz, PROT_READ|PROT_EXEC, errno = 0;
MAP_FILE|MAP_SHARED, fildes, 0)); addr = mmap(0, page_sz, PROT_READ|PROT_EXEC,
MAP_FILE|MAP_SHARED, fildes, 0);
/* Check for the return value of mmap() */ /* Check for the return value of mmap() */
if (TEST_RETURN == (int)MAP_FAILED) { if (addr == MAP_FAILED) {
tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s", tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s",
TEMPFILE, errno, strerror(errno)); TEMPFILE, errno, strerror(errno));
continue; continue;
@ -136,9 +137,6 @@ main(int ac, char **av)
* executed without (-f) option. * executed without (-f) option.
*/ */
if (STD_FUNCTIONAL_TEST) { if (STD_FUNCTIONAL_TEST) {
/* Get the mmap return value */
addr = (char *)TEST_RETURN;
/* /*
* Read the file contents into the dummy * Read the file contents into the dummy
* variable. * variable.

View File

@ -125,12 +125,12 @@ main(int ac, char **av)
* Call mmap to map the temporary file 'TEMPFILE' * Call mmap to map the temporary file 'TEMPFILE'
* with no access. * with no access.
*/ */
errno = 0;
TEST(mmap(0, page_sz, PROT_NONE, addr = mmap(0, page_sz, PROT_NONE,
MAP_FILE|MAP_SHARED, fildes, 0)); MAP_FILE|MAP_SHARED, fildes, 0);
/* Check for the return value of mmap() */ /* Check for the return value of mmap() */
if (TEST_RETURN == (int)MAP_FAILED) { if (addr == MAP_FAILED) {
tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s", tst_resm(TFAIL, "mmap() Failed on %s, errno=%d : %s",
TEMPFILE, errno, strerror(errno)); TEMPFILE, errno, strerror(errno));
continue; continue;
@ -264,7 +264,7 @@ setup()
* is not accessible. * is not accessible.
*/ */
void void
sig_handler(sig) sig_handler(int sig)
{ {
if (sig == SIGSEGV) { if (sig == SIGSEGV) {
/* set the global variable and jump back */ /* set the global variable and jump back */

View File

@ -121,11 +121,13 @@ main(int ac, char **av)
* Call mmap to map the temporary file 'TEMPFILE' * Call mmap to map the temporary file 'TEMPFILE'
* with read access. * with read access.
*/ */
TEST(mmap(0, page_sz, PROT_READ, errno = 0;
MAP_FILE|MAP_SHARED, fildes, 0)); addr = mmap(0, page_sz, PROT_READ,
MAP_FILE|MAP_SHARED, fildes, 0);
TEST_ERRNO = errno;
/* Check for the return value of mmap() */ /* Check for the return value of mmap() */
if (TEST_RETURN != (int)MAP_FAILED) { if (addr != MAP_FAILED) {
tst_resm(TFAIL, "mmap() returned invalid value, " tst_resm(TFAIL, "mmap() returned invalid value, "
"expected: -1"); "expected: -1");
/* Unmap the mapped memory */ /* Unmap the mapped memory */

View File

@ -122,11 +122,13 @@ main(int ac, char **av)
* Call mmap to map the temporary file 'TEMPFILE' * Call mmap to map the temporary file 'TEMPFILE'
* with write access. * with write access.
*/ */
TEST(mmap(0, page_sz, PROT_WRITE, errno = 0;
MAP_FILE|MAP_PRIVATE, fildes, 0)); addr = mmap(0, page_sz, PROT_WRITE,
MAP_FILE|MAP_PRIVATE, fildes, 0);
TEST_ERRNO = errno;
/* Check for the return value of mmap() */ /* Check for the return value of mmap() */
if (TEST_RETURN != (int)MAP_FAILED) { if (addr != MAP_FAILED) {
tst_resm(TFAIL, "mmap() returned invalid value, " tst_resm(TFAIL, "mmap() returned invalid value, "
"expected: -1"); "expected: -1");
/* Unmap the mapped memory */ /* Unmap the mapped memory */

View File

@ -117,11 +117,13 @@ main(int ac, char **av)
* Call mmap to map the temporary file 'TEMPFILE' * Call mmap to map the temporary file 'TEMPFILE'
* which is already closed. so, fildes is not valid. * which is already closed. so, fildes is not valid.
*/ */
TEST(mmap(0, page_sz, PROT_WRITE, errno = 0;
MAP_FILE|MAP_SHARED, fildes, 0)); addr = mmap(0, page_sz, PROT_WRITE,
MAP_FILE|MAP_SHARED, fildes, 0);
TEST_ERRNO = errno;
/* Check for the return value of mmap() */ /* Check for the return value of mmap() */
if (TEST_RETURN != (int)MAP_FAILED) { if (addr != MAP_FAILED) {
tst_resm(TFAIL, "mmap() returned invalid value, " tst_resm(TFAIL, "mmap() returned invalid value, "
"expected: -1"); "expected: -1");
/* Unmap the mapped memory */ /* Unmap the mapped memory */

View File

@ -145,7 +145,7 @@ main(int argc, char **argv)
unlink ("y.txt"); unlink ("y.txt");
if (!WIFEXITED (status) || WEXITSTATUS (status)) if (!WIFEXITED (status) || WEXITSTATUS (status))
{ {
printf ("forked process exited with status %p\n", (char *) status); printf ("forked process exited with status %x\n", status);
return 1; return 1;
} }
} }

View File

@ -61,7 +61,7 @@ main (int argc, char **argv)
} }
if (n != 0) if (n != 0)
{ {
fprintf (stderr, "system() call returned %p\n", (void *) n); fprintf (stderr, "system() call returned %x\n", n);
exit (1); exit (1);
} }
exit (0); exit (0);

View File

@ -133,11 +133,11 @@ ull * current = buffer;
static int is_valid (void * ptr) static int is_valid (void * ptr)
{ {
unsigned int iptr = (unsigned int) ptr; uintptr_t iptr = (uintptr_t) ptr;
ull * ullptr = (ull *) ptr; ull * ullptr = (ull *) ptr;
iptr = (iptr / sizeof(ull)) * sizeof(ull); iptr = (iptr / sizeof(ull)) * sizeof(ull);
if (iptr != (int) ptr) if (iptr != (uintptr_t) ptr)
return 0; return 0;
if (--ullptr < buffer || ullptr[0] > SIZE || ullptr + ullptr[0] > current) if (--ullptr < buffer || ullptr[0] > SIZE || ullptr + ullptr[0] > current)
return 0; return 0;