[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [unigbrk 2/2] unigbrk: New modules for grapheme clusters.
From: |
Bruno Haible |
Subject: |
Re: [unigbrk 2/2] unigbrk: New modules for grapheme clusters. |
Date: |
Sun, 2 Jan 2011 19:36:00 +0100 |
User-agent: |
KMail/1.9.9 |
Hi Ben,
When compiling a testdir configured with "./configure CPPFLAGS=-Wall", I'm
seeing these warnings:
unigbrk/u16-grapheme-breaks.c:35: warning: unused variable ‘i’
unigbrk/u16-grapheme-prev.c:29: warning: unused variable ‘mblen’
unigbrk/u8-grapheme-prev.c:29: warning: unused variable ‘mblen’
unigbrk/test-u16-grapheme-breaks.c:84: warning: unused variable ‘s’
unigbrk/test-u32-grapheme-breaks.c:84: warning: unused variable ‘s’
unigbrk/test-u8-grapheme-breaks.c:77: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_breaks’ differ in signedness
unigbrk/test-u8-grapheme-breaks.c:78: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_breaks’ differ in signedness
unigbrk/test-u8-grapheme-breaks.c:79: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_breaks’ differ in signedness
unigbrk/test-u8-grapheme-breaks.c:83: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_breaks’ differ in signedness
unigbrk/test-u8-grapheme-breaks.c:84: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_breaks’ differ in signedness
unigbrk/test-u8-grapheme-breaks.c:85: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_breaks’ differ in signedness
unigbrk/test-u8-grapheme-breaks.c:90: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_breaks’ differ in signedness
unigbrk/test-u8-grapheme-breaks.c:91: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_breaks’ differ in signedness
unigbrk/test-u8-grapheme-breaks.c:92: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_breaks’ differ in signedness
unigbrk/test-u8-grapheme-breaks.c:93: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_breaks’ differ in signedness
unigbrk/test-u8-grapheme-breaks.c:74: warning: unused variable ‘s’
unigbrk/test-u8-grapheme-next.c:59: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_next’ differ in signedness
unigbrk/test-u8-grapheme-next.c:60: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_next’ differ in signedness
unigbrk/test-u8-grapheme-next.c:61: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_next’ differ in signedness
unigbrk/test-u8-grapheme-next.c:65: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_next’ differ in signedness
unigbrk/test-u8-grapheme-next.c:66: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_next’ differ in signedness
unigbrk/test-u8-grapheme-next.c:67: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_next’ differ in signedness
unigbrk/test-u8-grapheme-next.c:72: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_next’ differ in signedness
unigbrk/test-u8-grapheme-next.c:73: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_next’ differ in signedness
unigbrk/test-u8-grapheme-next.c:74: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_next’ differ in signedness
unigbrk/test-u8-grapheme-next.c:75: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_next’ differ in signedness
unigbrk/test-u8-grapheme-prev.c:57: warning: pointer targets in passing
argument 1 of ‘u8_grapheme_prev’ differ in signedness
unigbrk/test-u8-grapheme-prev.c:57: warning: pointer targets in passing
argument 2 of ‘u8_grapheme_prev’ differ in signedness
unigbrk/test-u8-grapheme-prev.c:60: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_prev’ differ in signedness
unigbrk/test-u8-grapheme-prev.c:61: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_prev’ differ in signedness
unigbrk/test-u8-grapheme-prev.c:62: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_prev’ differ in signedness
unigbrk/test-u8-grapheme-prev.c:66: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_prev’ differ in signedness
unigbrk/test-u8-grapheme-prev.c:67: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_prev’ differ in signedness
unigbrk/test-u8-grapheme-prev.c:68: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_prev’ differ in signedness
unigbrk/test-u8-grapheme-prev.c:73: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_prev’ differ in signedness
unigbrk/test-u8-grapheme-prev.c:74: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_prev’ differ in signedness
unigbrk/test-u8-grapheme-prev.c:75: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_prev’ differ in signedness
unigbrk/test-u8-grapheme-prev.c:76: warning: pointer targets in passing
argument 1 of ‘test_u8_grapheme_prev’ differ in signedness
unigbrk/test-uc-is-grapheme-break.c:113: warning: format ‘%d’ expects type
‘int’, but argument 5 has type ‘long int’
unigbrk/test-uc-is-grapheme-break.c:129: warning: format ‘%d’ expects type
‘int’, but argument 5 has type ‘long int’
I'm committing this fix, to get rid of them:
2011-01-02 Bruno Haible <address@hidden>
unigbrk: Avoid gcc warnings.
* lib/unigbrk/u16-grapheme-breaks.c (u16_grapheme_breaks): Remove
unused variable.
* lib/unigbrk/u16-grapheme-prev.c (u16_grapheme_prev): Likewise.
* lib/unigbrk/u8-grapheme-prev.c (u8_grapheme_prev): Likewise.
* tests/unigbrk/test-u16-grapheme-breaks.c (main): Likewise.
* tests/unigbrk/test-u32-grapheme-breaks.c (main): Likewise.
* tests/unigbrk/test-u8-grapheme-breaks.c (test_u8_grapheme_breaks):
Change type of first argument to 'const char *'.
(main): Remove unused variable.
* tests/unigbrk/test-u8-grapheme-next.c (test_u8_grapheme_next): Change
type of first argument to 'const char *'.
* tests/unigbrk/test-u8-grapheme-prev.c (test_u8_grapheme_prev):
Likewise.
(main): Change type of variable 's'.
* tests/unigbrk/test-uc-is-grapheme-break.c (main): Cast column number
to 'int'.
--- lib/unigbrk/u16-grapheme-breaks.c.orig Sun Jan 2 19:24:36 2011
+++ lib/unigbrk/u16-grapheme-breaks.c Sun Jan 2 19:11:41 2011
@@ -32,7 +32,6 @@
for (; n > 0; s += mblen, p += mblen, n -= mblen)
{
ucs4_t next;
- int i;
mblen = u16_mbtouc (&next, s, n);
--- lib/unigbrk/u16-grapheme-prev.c.orig Sun Jan 2 19:24:36 2011
+++ lib/unigbrk/u16-grapheme-prev.c Sun Jan 2 19:12:03 2011
@@ -26,7 +26,6 @@
u16_grapheme_prev (const uint16_t *s, const uint16_t *start)
{
ucs4_t next;
- int mblen;
if (s == start)
return NULL;
--- lib/unigbrk/u8-grapheme-prev.c.orig Sun Jan 2 19:24:36 2011
+++ lib/unigbrk/u8-grapheme-prev.c Sun Jan 2 19:11:57 2011
@@ -26,7 +26,6 @@
u8_grapheme_prev (const uint8_t *s, const uint8_t *start)
{
ucs4_t next;
- int mblen;
if (s == start)
return NULL;
--- tests/unigbrk/test-u16-grapheme-breaks.c.orig Sun Jan 2 19:24:36 2011
+++ tests/unigbrk/test-u16-grapheme-breaks.c Sun Jan 2 19:13:09 2011
@@ -81,8 +81,6 @@
int
main (void)
{
- static const char s[] = "abc";
-
/* Standalone 1-unit graphemes. */
test_u16_grapheme_breaks ("#", 'a', -1);
test_u16_grapheme_breaks ("##", 'a', 'b', -1);
--- tests/unigbrk/test-u32-grapheme-breaks.c.orig Sun Jan 2 19:24:36 2011
+++ tests/unigbrk/test-u32-grapheme-breaks.c Sun Jan 2 19:13:40 2011
@@ -81,8 +81,6 @@
int
main (void)
{
- static const char s[] = "abc";
-
/* Standalone 1-unit graphemes. */
test_u32_grapheme_breaks ("#", 'a', -1);
test_u32_grapheme_breaks ("##", 'a', 'b', -1);
--- tests/unigbrk/test-u8-grapheme-breaks.c.orig Sun Jan 2 19:24:36 2011
+++ tests/unigbrk/test-u8-grapheme-breaks.c Sun Jan 2 19:17:33 2011
@@ -28,8 +28,9 @@
#include "macros.h"
static void
-test_u8_grapheme_breaks (const uint8_t *s, const char *expected)
+test_u8_grapheme_breaks (const char *input, const char *expected)
{
+ const uint8_t *s = (const uint8_t *) input;
size_t n = strlen (expected);
char *breaks;
size_t i;
@@ -71,8 +72,6 @@
int
main (void)
{
- static const char s[] = "abc";
-
/* Standalone 1-unit graphemes. */
test_u8_grapheme_breaks ("a", "#");
test_u8_grapheme_breaks ("ab", "##");
--- tests/unigbrk/test-u8-grapheme-next.c.orig Sun Jan 2 19:24:36 2011
+++ tests/unigbrk/test-u8-grapheme-next.c Sun Jan 2 19:18:14 2011
@@ -27,8 +27,9 @@
#include "macros.h"
static void
-test_u8_grapheme_next (const uint8_t *s, size_t n, size_t len)
+test_u8_grapheme_next (const char *input, size_t n, size_t len)
{
+ const uint8_t *s = (const uint8_t *) input;
const uint8_t *next = u8_grapheme_next (s, s + n);
if (next != s + len)
{
--- tests/unigbrk/test-u8-grapheme-prev.c.orig Sun Jan 2 19:24:36 2011
+++ tests/unigbrk/test-u8-grapheme-prev.c Sun Jan 2 19:23:49 2011
@@ -27,8 +27,9 @@
#include "macros.h"
static void
-test_u8_grapheme_prev (const uint8_t *s, size_t n, size_t len)
+test_u8_grapheme_prev (const char *input, size_t n, size_t len)
{
+ const uint8_t *s = (const uint8_t *) input;
const uint8_t *end = s + n;
const uint8_t *prev = u8_grapheme_prev (end, s);
if (prev != end - len)
@@ -50,7 +51,7 @@
int
main (void)
{
- static const char s[] = "abc";
+ static const uint8_t s[] = "abc";
/* Empty string. */
ASSERT (u8_grapheme_prev (NULL, NULL) == NULL);
--- tests/unigbrk/test-uc-is-grapheme-break.c.orig Sun Jan 2 19:24:37 2011
+++ tests/unigbrk/test-uc-is-grapheme-break.c Sun Jan 2 19:21:16 2011
@@ -110,7 +110,7 @@
else
{
fprintf (stderr, "%s:%d.%d: syntax error expecting `÷' or `÷'\n",
- filename, lineno, p - line + 1);
+ filename, lineno, (int) (p - line + 1));
exit (1);
}
@@ -126,7 +126,7 @@
{
fprintf (stderr, "%s:%d.%d: syntax error at `%s' expecting "
"hexadecimal Unicode code point number\n",
- filename, lineno, p - line + 1, p);
+ filename, lineno, (int) (p - line + 1), p);
exit (1);
}
p += n;