diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-05-18 17:20:41 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-05-18 17:21:05 -0700 |
commit | 12335899d0089131d854aa1b074f0c4d841dff42 (patch) | |
tree | ac45e8fac2869702eea8075f560d93ad1317572b /tests | |
parent | 6e5f53c09490a510344a65d26f5e3989a048fcdf (diff) | |
download | gnulib-12335899d0089131d854aa1b074f0c4d841dff42.tar.gz |
parse-datetime, tests: don't use "string" + int
Recent versions of 'clang' complain about C source code that
uses expressions of the form '"string literal" + integer',
I guess on the theory that it's confusing for readers who are
used to C++. On those grounds I suppose it's OK to make this
minor style change.
* lib/parse-datetime.y (parse_datetime):
* tests/test-fchdir.c (main):
* tests/test-snprintf-posix.h (test_function):
* tests/test-snprintf.c (main):
* tests/test-vasnprintf-posix.c (test_function):
* tests/test-vasnprintf.c (test_function):
* tests/test-vsnprintf.c (main):
* tests/unistdio/test-ulc-asnprintf1.h (test_function):
Rewrite '"str" + E' to '&"str"[E]'.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-fchdir.c | 2 | ||||
-rw-r--r-- | tests/test-snprintf-posix.h | 2 | ||||
-rw-r--r-- | tests/test-snprintf.c | 2 | ||||
-rw-r--r-- | tests/test-vasnprintf-posix.c | 2 | ||||
-rw-r--r-- | tests/test-vasnprintf.c | 2 | ||||
-rw-r--r-- | tests/test-vsnprintf.c | 2 | ||||
-rw-r--r-- | tests/unistdio/test-ulc-asnprintf1.h | 2 |
7 files changed, 7 insertions, 7 deletions
diff --git a/tests/test-fchdir.c b/tests/test-fchdir.c index 7ffc71baa7..7a6de80494 100644 --- a/tests/test-fchdir.c +++ b/tests/test-fchdir.c @@ -70,7 +70,7 @@ main (void) /* Repeat test twice, once in '.' and once in '..'. */ for (i = 0; i < 2; i++) { - ASSERT (chdir (".." + 1 - i) == 0); + ASSERT (chdir (&".."[1 - i]) == 0); ASSERT (fchdir (fd) == 0); { size_t len = strlen (cwd) + 1; diff --git a/tests/test-snprintf-posix.h b/tests/test-snprintf-posix.h index 72b8c4ae37..f71b3f73fc 100644 --- a/tests/test-snprintf-posix.h +++ b/tests/test-snprintf-posix.h @@ -96,7 +96,7 @@ test_function (int (*my_snprintf) (char *, size_t, const char *, ...)) ASSERT (memcmp (buf, "12345", size - 1) == 0); ASSERT (buf[size - 1] == '\0'); } - ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); + ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); } else { diff --git a/tests/test-snprintf.c b/tests/test-snprintf.c index 805735769e..108346e129 100644 --- a/tests/test-snprintf.c +++ b/tests/test-snprintf.c @@ -52,7 +52,7 @@ main (int argc, char *argv[]) #if !CHECK_SNPRINTF_POSIX if (size > 0) #endif - ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); + ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); } else { diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c index 70582b7122..af779cd727 100644 --- a/tests/test-vasnprintf-posix.c +++ b/tests/test-vasnprintf-posix.c @@ -118,7 +118,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) ASSERT (length == 5); if (size < 6) ASSERT (result != buf); - ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); + ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); if (result != buf) free (result); } diff --git a/tests/test-vasnprintf.c b/tests/test-vasnprintf.c index f29b05aeb5..4cce0a947a 100644 --- a/tests/test-vasnprintf.c +++ b/tests/test-vasnprintf.c @@ -55,7 +55,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) ASSERT (length == 5); if (size < 6) ASSERT (result != buf); - ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); + ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); if (result != buf) free (result); } diff --git a/tests/test-vsnprintf.c b/tests/test-vsnprintf.c index 3353b2eb47..84b5d89676 100644 --- a/tests/test-vsnprintf.c +++ b/tests/test-vsnprintf.c @@ -65,7 +65,7 @@ main (int argc, char *argv[]) #if !CHECK_VSNPRINTF_POSIX if (size > 0) #endif - ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); + ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); } else { diff --git a/tests/unistdio/test-ulc-asnprintf1.h b/tests/unistdio/test-ulc-asnprintf1.h index 9342f42049..905e9c6ae7 100644 --- a/tests/unistdio/test-ulc-asnprintf1.h +++ b/tests/unistdio/test-ulc-asnprintf1.h @@ -47,7 +47,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) ASSERT (length == 5); if (size < 6) ASSERT (result != buf); - ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); + ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0); if (result != buf) free (result); } |