Project

General

Profile

Backport #6748

bignum.c does not compile

Added by pedz (Perry Smith) about 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:46534]

Description

I'm using the ruby_1_9_3 branch of ruby/ruby on github and bignum.c does not compile with an error that ffs is not defined.

I'm on AIX 6.1 TL07 SP03.

I assume HAVE_STRING_H is set (because AIX has string.h and strings.h) so ruby/ruby.h includes string.h but ffs is defined in strings.h.

I noticed that time.c also uses ffs and it simply includes strings.h from within a #if construct.

Adding:
diff --git a/bignum.c b/bignum.c
index 8d024fe..0439062 100644
--- a/bignum.c
+++ b/bignum.c
@@ -13,6 +13,9 @@
#include "ruby/util.h"
#include "internal.h"

+#ifdef HAVE_STRINGS_H
+#include
+#endif
#include
#include
#include

resolves the issue.

Associated revisions

Revision 7d4e7fe8
Added by kosaki (Motohiro KOSAKI) about 7 years ago

  • bignum.c: Added #include for ffs(). Patch by Perry Smith. Thank you. [Bug #6748]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 36455
Added by kosaki (Motohiro KOSAKI) about 7 years ago

  • bignum.c: Added #include for ffs(). Patch by Perry Smith. Thank you. [Bug #6748]

Revision 36455
Added by kosaki (Motohiro KOSAKI) about 7 years ago

  • bignum.c: Added #include for ffs(). Patch by Perry Smith. Thank you. [Bug #6748]

Revision 36455
Added by kosaki (Motohiro KOSAKI) about 7 years ago

  • bignum.c: Added #include for ffs(). Patch by Perry Smith. Thank you. [Bug #6748]

Revision 36455
Added by kosaki (Motohiro KOSAKI) about 7 years ago

  • bignum.c: Added #include for ffs(). Patch by Perry Smith. Thank you. [Bug #6748]

Revision 36455
Added by kosaki (Motohiro KOSAKI) about 7 years ago

  • bignum.c: Added #include for ffs(). Patch by Perry Smith. Thank you. [Bug #6748]

Revision 36455
Added by kosaki (Motohiro KOSAKI) about 7 years ago

  • bignum.c: Added #include for ffs(). Patch by Perry Smith. Thank you. [Bug #6748]

Revision 02385465
Added by naruse (Yui NARUSE) almost 7 years ago

merge revision(s) 36455:

    * bignum.c: Added #include <strings.h> for ffs(). Patch by Perry
      Smith. Thank you. [Bug #6748]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 36560
Added by naruse (Yui NARUSE) almost 7 years ago

merge revision(s) 36455:

* bignum.c: Added #include <strings.h> for ffs(). Patch by Perry
  Smith. Thank you. [Bug #6748]

History

Updated by naruse (Yui NARUSE) about 7 years ago

  • Status changed from Open to Assigned
  • Assignee set to kanemoto (Yutaka Kanemoto)

Updated by kosaki (Motohiro KOSAKI) about 7 years ago

I think it is not AIX specific issue. ffs() is defined in strings.h on almost all platform. but gcc and clang have built-in ffs. then we can't see this issue on Linux nor *BSD.

#3

Updated by kosaki (Motohiro KOSAKI) about 7 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r36455.
Perry, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • bignum.c: Added #include for ffs(). Patch by Perry Smith. Thank you. [Bug #6748]
#4

Updated by kosaki (Motohiro KOSAKI) about 7 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport193
  • Target version deleted (1.9.3)

Updated by ktsj (Kazuki Tsujimoto) almost 7 years ago

  • Status changed from Closed to Assigned
  • Assignee changed from kanemoto (Yutaka Kanemoto) to naruse (Yui NARUSE)

Updated by pedz (Perry Smith) almost 7 years ago

It may work to change ruby/ruby.h to first include string.h if the platform has it and then include strings.h if the platform has it rather than one or the other. Note that time.c already includes both if both are defined so including both should be ok.

#7

Updated by naruse (Yui NARUSE) almost 7 years ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r36560.
Perry, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 36455:

* bignum.c: Added #include <strings.h> for ffs(). Patch by Perry
  Smith. Thank you. [Bug #6748]

Also available in: Atom PDF