Bug #2153
closedBuilt issue with include/ruby/st.h (expected declaration ... before ‘uint32_t’)
Description
=begin
With Revision 25132 there was a slightly change in include/ruby/st.h:
@@ -109,7 +109,7 @@
int st_strncasecmp(const char *s1, const char *s2, size_t n);
size_t st_memsize(const st_table *);
st_index_t st_hash(const void *ptr, size_t len, st_index_t h);
-st_index_t st_hash_uint32(st_index_t h, unsigned int i);
+st_index_t st_hash_uint32(st_index_t h, uint32_t i);
st_index_t st_hash_uint(st_index_t h, st_index_t i);
st_index_t st_hash_end(st_index_t h);
st_index_t st_hash_start(st_index_t h);
The log message describe this change as a "fix for cygwin". But on my system:
ruby 1.9.2dev (2009-09-28 trunk 25135) [x86_64-darwin10.0.0]
The following happens during compiling:
gcc -I. -I../../.ext/include/x86_64-darwin10.0.0 -I../.././include -I../.././ext/syck -DRUBY_EXTCONF_H="extconf.h" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -fomit-frame-pointer -ggdb -Wall -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -fno-common -pipe -o gram.o -c gram.c
In file included from syck.h:21,
from gram.y:16:
../.././include/ruby/st.h:112: error: expected declaration specifiers or ‘...’ before ‘uint32_t’
make[1]: *** [gram.o] Error 1
make: *** [mkmain.sh] Error 1
I don't want to provide a patch, because I don't know how it will apply to the mention cygwin issue.
=end
Updated by nlugovoi (Nikolai Lugovoi) about 15 years ago
=begin
On Mon, Sep 28, 2009 at 5:24 PM, Daniel Bovensiepen
redmine@ruby-lang.org wrote:
The following happens during compiling:
gcc -I. -I../../.ext/include/x86_64-darwin10.0.0 -I../.././include -I../.././ext/syck -DRUBY_EXTCONF_H="extconf.h" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -fomit-frame-pointer -ggdb -Wall -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -fno-common -pipe -o gram.o -c gram.c
In file included from syck.h:21,
from gram.y:16:
../.././include/ruby/st.h:112: error: expected declaration specifiers or ‘...’ before ‘uint32_t’
make[1]: *** [gram.o] Error 1
make: *** [mkmain.sh] Error 1I don't want to provide a patch, because I don't know how it will apply to the mention cygwin issue.
Hi,
You could use following patch for ext/syck/syck.h, that would add
necessary includes (<stdint.h>):
index 81b3d67..4657349 100644
--- a/ext/syck/syck.h
+++ b/ext/syck/syck.h
@@ -18,7 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
-#include "ruby/st.h"
+#include "ruby/ruby.h"
#if defined(__cplusplus)
extern "C" {
=end
Updated by duerst (Martin Dürst) about 15 years ago
- Assignee set to nobu (Nobuyoshi Nakada)
=begin
This is the error that I got in cygwin before revision 25132:
gcc -O3 -fomit-frame-pointer -g -Wall -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -I. -I.ext/include/i386-cygwin -I./include -I. -DRUBY_EXPORT -o st.o -c st.c
st.c:1187: error: conflicting types for 'st_hash_uint32'
./include/ruby/st.h:112: error: previous declaration of 'st_hash_uint32' was here
st.c:1187: error: conflicting types for 'st_hash_uint32'
./include/ruby/st.h:112: error: previous declaration of 'st_hash_uint32' was here
make: *** [st.o] Error 1
Thinking whether to change st.c or st.h, I changed st.h, because the name of the function contains uint32, and therefore the type uint32_t seemed to make more sense than a simple unsigned int.
I think Nobuyoshi is best qualified to figure out what he wanted, because this code is originally from him (revision 25106 or so). So I'm assigning this bug to him.
Regards, Martin.
=end
Updated by naruse (Yui NARUSE) about 15 years ago
- Category set to core
- Status changed from Open to Closed
=begin
I added include inttypes.h and stdint.h to st.h in r25138.
=end