mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 13:09:22 +00:00
Avoid gcc warnings.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2002-10-03 Bruno Haible <bruno@clisp.org>
|
||||||
|
|
||||||
|
* tests/Makefile.in: Use gperf option -I, to avoid gcc-3.x warnings.
|
||||||
|
* tests/test.c: Don't use gets(), to avoid warnings.
|
||||||
|
|
||||||
2001-08-02 Bruno Haible <bruno@linuix.math.u-bordeaux.fr>
|
2001-08-02 Bruno Haible <bruno@linuix.math.u-bordeaux.fr>
|
||||||
|
|
||||||
* doc/gperf.texi: Change bug report address to <bug-gnu-gperf@gnu.org>.
|
* doc/gperf.texi: Change bug report address to <bug-gnu-gperf@gnu.org>.
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ extracheck : @CHECK_LANG_SYNTAX@
|
|||||||
check-link-c: force
|
check-link-c: force
|
||||||
@echo "performing some tests of the perfect hash generator"
|
@echo "performing some tests of the perfect hash generator"
|
||||||
$(CC) -c $(CFLAGS) $(srcdir)/test.c
|
$(CC) -c $(CFLAGS) $(srcdir)/test.c
|
||||||
$(GPERF) -p -c -l -S1 -o $(srcdir)/c.gperf > cinset.c
|
$(GPERF) -p -c -l -S1 -I -o $(srcdir)/c.gperf > cinset.c
|
||||||
$(CC) $(CFLAGS) -o cout cinset.c test.o
|
$(CC) $(CFLAGS) -o cout cinset.c test.o
|
||||||
|
|
||||||
check-link-c++: force
|
check-link-c++: force
|
||||||
@@ -75,27 +75,27 @@ check-c:
|
|||||||
diff $(srcdir)/c.exp c.out
|
diff $(srcdir)/c.exp c.out
|
||||||
|
|
||||||
check-ada:
|
check-ada:
|
||||||
$(GPERF) -k1,4,'$$' $(srcdir)/ada.gperf > adainset.c
|
$(GPERF) -k1,4,'$$' -I $(srcdir)/ada.gperf > adainset.c
|
||||||
# double '$$' is only there since make gets confused; program wants only 1 '$'
|
# double '$$' is only there since make gets confused; program wants only 1 '$'
|
||||||
$(CC) $(CFLAGS) -o aout adainset.c test.o
|
$(CC) $(CFLAGS) -o aout adainset.c test.o
|
||||||
@echo "testing Ada reserved words, all items should be found in the set"
|
@echo "testing Ada reserved words, all items should be found in the set"
|
||||||
./aout -v < $(srcdir)/ada.gperf > ada-res.out
|
./aout -v < $(srcdir)/ada.gperf > ada-res.out
|
||||||
diff $(srcdir)/ada-res.exp ada-res.out
|
diff $(srcdir)/ada-res.exp ada-res.out
|
||||||
$(GPERF) -p -D -k1,'$$' -s 2 -o $(srcdir)/adadefs.gperf > preinset.c
|
$(GPERF) -p -D -k1,'$$' -s 2 -I -o $(srcdir)/adadefs.gperf > preinset.c
|
||||||
$(CC) $(CFLAGS) -o preout preinset.c test.o
|
$(CC) $(CFLAGS) -o preout preinset.c test.o
|
||||||
@echo "testing Ada predefined words, all items should be found in the set"
|
@echo "testing Ada predefined words, all items should be found in the set"
|
||||||
./preout -v < $(srcdir)/adadefs.gperf > ada-pred.out
|
./preout -v < $(srcdir)/adadefs.gperf > ada-pred.out
|
||||||
diff $(srcdir)/ada-pred.exp ada-pred.out
|
diff $(srcdir)/ada-pred.exp ada-pred.out
|
||||||
|
|
||||||
check-modula3:
|
check-modula3:
|
||||||
$(GPERF) -k1,2,'$$' -o $(srcdir)/modula3.gperf > m3inset.c
|
$(GPERF) -k1,2,'$$' -I -o $(srcdir)/modula3.gperf > m3inset.c
|
||||||
$(CC) $(CFLAGS) -o m3out m3inset.c test.o
|
$(CC) $(CFLAGS) -o m3out m3inset.c test.o
|
||||||
@echo "testing Modula3 reserved words, all items should be found in the set"
|
@echo "testing Modula3 reserved words, all items should be found in the set"
|
||||||
./m3out -v < $(srcdir)/modula3.gperf > modula.out
|
./m3out -v < $(srcdir)/modula3.gperf > modula.out
|
||||||
diff $(srcdir)/modula.exp modula.out
|
diff $(srcdir)/modula.exp modula.out
|
||||||
|
|
||||||
check-pascal:
|
check-pascal:
|
||||||
$(GPERF) -o -S2 -p < $(srcdir)/pascal.gperf > pinset.c
|
$(GPERF) -o -S2 -p -I < $(srcdir)/pascal.gperf > pinset.c
|
||||||
$(CC) $(CFLAGS) -o pout pinset.c test.o
|
$(CC) $(CFLAGS) -o pout pinset.c test.o
|
||||||
@echo "testing Pascal reserved words, all items should be found in the set"
|
@echo "testing Pascal reserved words, all items should be found in the set"
|
||||||
./pout -v < $(srcdir)/pascal.gperf > pascal.out
|
./pout -v < $(srcdir)/pascal.gperf > pascal.out
|
||||||
|
|||||||
18
tests/test.c
18
tests/test.c
@@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define MAX_LEN 80
|
#define MAX_LEN 80
|
||||||
|
|
||||||
@@ -16,11 +17,22 @@ main (argc, argv)
|
|||||||
int verbose = argc > 1 ? 1 : 0;
|
int verbose = argc > 1 ? 1 : 0;
|
||||||
char buf[MAX_LEN];
|
char buf[MAX_LEN];
|
||||||
|
|
||||||
while (gets (buf))
|
while (fgets (buf, MAX_LEN, stdin))
|
||||||
if (in_word_set (buf, strlen (buf)) && verbose)
|
{
|
||||||
|
if (strlen (buf) > 0 && buf[strlen (buf) - 1] == '\n')
|
||||||
|
buf[strlen (buf) - 1] = '\0';
|
||||||
|
|
||||||
|
if (in_word_set (buf, strlen (buf)))
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
printf ("in word set %s\n", buf);
|
printf ("in word set %s\n", buf);
|
||||||
else if (verbose)
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
printf ("NOT in word set %s\n", buf);
|
printf ("NOT in word set %s\n", buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,10 +49,17 @@ main (argc, argv)
|
|||||||
if (buflen == 0)
|
if (buflen == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (in_word_set (buf, buflen) && verbose)
|
if (in_word_set (buf, buflen))
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
printf ("in word set:");
|
printf ("in word set:");
|
||||||
else if (verbose)
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (verbose)
|
||||||
printf ("NOT in word set:");
|
printf ("NOT in word set:");
|
||||||
|
}
|
||||||
|
|
||||||
for (p = buf; p < buf + buflen; p += 2)
|
for (p = buf; p < buf + buflen; p += 2)
|
||||||
printf (" %02X%02X", (unsigned char) p[0], (unsigned char) p[1]);
|
printf (" %02X%02X", (unsigned char) p[0], (unsigned char) p[1]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user