Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 332018 Details for
Bug 251873
dev-ada/cbind multiple QA problems
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to go with c2ada ebuild
warn-0.26.patch (text/plain), 5.97 KB, created by
Thomas J. Moore
on 2012-12-11 03:43:55 UTC
(
hide
)
Description:
Patch to go with c2ada ebuild
Filename:
MIME Type:
Creator:
Thomas J. Moore
Created:
2012-12-11 03:43:55 UTC
Size:
5.97 KB
patch
obsolete
>Not only are these format strings wrong, they are unnecessary. No >size is larger than what fits into an int, so casting is the correct, >portable answer. > >--- c2ada-0.26/htype.c 2012-12-10 19:29:18.000000000 -0600 >+++ c2ada-0.26/htype.c 2012-12-10 19:30:19.000000000 -0600 >@@ -99,28 +99,17 @@ > main() > { > >- /* format strings for printing *SIZE values */ >-#ifdef __APPLE__ >-#define SIZE_FLAG "%lu" >-#elif defined linux >-#define SIZE_FLAG "%u" >-#elif defined sun >-#define SIZE_FLAG "%u" >-#else >-#define SIZE_FLAG "%u" >-#endif >- > printf("#define BITS_PER_BYTE\t\t\t%d\n\n", NBBY); >- printf("#define SIZEOF_CHAR\t\t\t" SIZE_FLAG "\n", CHAR_SIZE); >- printf("#define SIZEOF_SHORT\t\t\t" SIZE_FLAG "\n", SHORT_SIZE); >- printf("#define SIZEOF_INT\t\t\t" SIZE_FLAG "\n", INT_SIZE); >- printf("#define SIZEOF_LONG\t\t\t" SIZE_FLAG "\n", LONG_SIZE); >- printf("#define SIZEOF_FLOAT\t\t\t" SIZE_FLAG "\n", FLOAT_SIZE); >- printf("#define SIZEOF_DOUBLE\t\t\t" SIZE_FLAG "\n", DOUBLE_SIZE); >- printf("#define SIZEOF_LONG_DOUBLE\t\t" SIZE_FLAG "\n", LONG_DOUBLE_SIZE); >- printf("#define SIZEOF_ADDRESS\t\t\t" SIZE_FLAG "\n", ADDRESS_SIZE); >+ printf("#define SIZEOF_CHAR\t\t\t%u\n", (int)CHAR_SIZE); >+ printf("#define SIZEOF_SHORT\t\t\t%u\n", (int)SHORT_SIZE); >+ printf("#define SIZEOF_INT\t\t\t%u\n", (int)INT_SIZE); >+ printf("#define SIZEOF_LONG\t\t\t%u\n", (int)LONG_SIZE); >+ printf("#define SIZEOF_FLOAT\t\t\t%u\n", (int)FLOAT_SIZE); >+ printf("#define SIZEOF_DOUBLE\t\t\t%u\n", (int)DOUBLE_SIZE); >+ printf("#define SIZEOF_LONG_DOUBLE\t\t%u\n", (int)LONG_DOUBLE_SIZE); >+ printf("#define SIZEOF_ADDRESS\t\t\t%u\n", (int)ADDRESS_SIZE); > >- printf("\n#define ALIGNOF_CHAR\t\t\t" SIZE_FLAG "\n", CHAR_SIZE); >+ printf("\n#define ALIGNOF_CHAR\t\t\t%u\n", (int)CHAR_SIZE); > printf("#define ALIGNOF_SHORT\t\t\t%d\n", alignof_short()); > printf("#define ALIGNOF_INT\t\t\t%d\n", alignof_int()); > printf("#define ALIGNOF_LONG\t\t\t%d\n", alignof_long()); > >Apparently nexttok defaults to the character if it's not one of the >enum constants. This just suppresses the warning. > >--- c2ada-0.26/cpp_eval.c 2012-12-10 19:37:13.000000000 -0600 >+++ c2ada-0.26/cpp_eval.c 2012-12-10 19:38:46.000000000 -0600 >@@ -554,7 +554,7 @@ > s->nexttok = s->c; > s->c = getc(s); > >- switch (s->nexttok) { >+ switch ((int)s->nexttok) { > case '/': > if (s->c == '*') { > s->c = skip_c_comment(getc(s),s); >@@ -663,7 +663,7 @@ > { > tokval_t val; > >- switch (s->curtok) { >+ switch ((int)s->curtok) { > case tok_discrete: > case tok_float: > case tok_string: >@@ -748,7 +748,7 @@ > l = term(s); > > for (;;) { >- switch (s->curtok) { >+ switch ((int)s->curtok) { > case '*': > case '/': > case '%': >@@ -818,7 +818,7 @@ > l = f10(s); > > for (;;) { >- switch (s->curtok) { >+ switch ((int)s->curtok) { > case '+': > case '-': > op = s->curtok; > >Apparently gperf doesn't include string.h, so strcmp is undefined. > >--- c2ada-0.26/Makefile 2012-12-10 19:42:20.000000000 -0600 >+++ c2ada-0.26/Makefile 2012-12-10 19:46:16.000000000 -0600 >@@ -280,13 +280,13 @@ > ./hostinfo $@ > > c_perf.c: c.prf >- $(GPERF) -t -p c.prf > $@ >+ (echo '#include <string.h>'; $(GPERF) -t -p c.prf) > $@ > > ada_perf.c: ada.prf >- $(GPERF) -k1,4,'$$' -N ada_keyword ada.prf > $@ >+ (echo '#include <string.h>'; $(GPERF) -k1,4,'$$' -N ada_keyword ada.prf) > $@ > > cpp_perf.c: cpp.prf >- $(GPERF) -N cpp_keyword -t -p cpp.prf > $@ >+ (echo '#include <string.h>'; $(GPERF) -N cpp_keyword -t -p cpp.prf) > $@ > > cpp_perf.o: cpp_perf.c files.h hash.h cpp.h buffer.h > ada_perf.o: ada_perf.c > >The return code from unmap_file is ignored anyway, so just drop it. > >--- c2ada-0.26/files.c 2012-12-10 19:48:56.000000000 -0600 >+++ c2ada-0.26/files.c 2012-12-10 19:49:08.000000000 -0600 >@@ -166,10 +166,10 @@ > return mmap(0, fsize, PROT_READ, MAP_PRIVATE, fd, 0); > } > >-int >+void > unmap_file(void * addr, size_t len) > { >- return munmap(addr, (int)len); >+ (void)munmap(addr, (int)len); > } > > #else /* This system doesn't support mmap() and munmap() */ >@@ -191,7 +191,7 @@ > return addr; > } > >-int >+void > unmap_file(addr, len) > void *addr; > size_t len; >--- c2ada-0.26/files.h 2012-12-10 20:02:48.000000000 -0600 >+++ c2ada-0.26/files.h 2012-12-10 20:02:39.000000000 -0600 >@@ -57,7 +57,7 @@ > > extern size_t sizeof_file(int fd); > extern void *map_file(int fd, size_t fsize); >-extern int unmap_file(void *addr, size_t len); >+extern void unmap_file(void *addr, size_t len); > extern int compare_path(char *s1, char *s2); > > /* convenience functions to use file_pos_t for warnings */ > >hostinfo.h needs to exist for gcc to create the .d files. The touch >of hostinfo ensures that hostinfo.h will eventually be built properly. > >--- c2ada-0.26/Makefile 2012-12-10 19:42:20.000000000 -0600 >+++ c2ada-0.26/Makefile 2012-12-10 19:55:51.000000000 -0600 >@@ -307,6 +307,7 @@ > # Dependencies > > %.d: %.c >+ test -e hostinfo.h || (touch hostinfo.h; sleep 1; touch hostinfo) > $(SHELL) -ec 'gcc -MM $(CFLAGS) $< | sed "s/$*\\.o[n:]*/$@ &/g" >$@' > > include $(SRCS:.c=.d) > >y.tab.h needs to exist as well. There is no point in the duplicate >run of yacc. > >--- c2ada-0.26/Makefile 2012-12-10 20:07:44.000000000 -0600 >+++ c2ada-0.26/Makefile 2012-12-10 20:07:31.000000000 -0600 >@@ -292,10 +292,10 @@ > ada_perf.o: ada_perf.c > > y.tab.h: grammar.y >+ @echo "one reduce/reduce conflict expected" > $(YACC) -d grammar.y > >-y.tab.c: grammar.y >- echo "one reduce/reduce conflict expected"; $(YACC) grammar.y >+y.tab.c: y.tab.h > > #-------------------------------------------------------------------------- > # Configuration file for Python module set > >Remove a few implicit decl warnings, the wrong way. The right way >would be to move these into a header file, include in both places, and >also fix the K&R-style function defs and add "const" to "char *". > >--- c2ada-0.26/grammar.y 2012-12-10 20:52:02.000000000 -0600 >+++ c2ada-0.26/grammar.y 2012-12-10 20:51:38.000000000 -0600 >@@ -22,6 +22,8 @@ > extern comment_block_pt fetch_comment_block(void); > extern void yield_typedef(boolean); > extern void td(void); >+extern int yylex(void); >+extern void yyerror(char *); > > %} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 251873
:
332016
| 332018