Project

General

Profile

Actions

Backport #6748

closed

bignum.c does not compile

Added by pedz (Perry Smith) over 11 years ago. Updated over 11 years ago.

Status:
Closed
[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 <strings.h>
+#endif
#include <math.h>
#include <float.h>
#include <ctype.h>

resolves the issue.

Updated by naruse (Yui NARUSE) over 11 years ago

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

Updated by kosaki (Motohiro KOSAKI) over 11 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.

Actions #3

Updated by kosaki (Motohiro KOSAKI) over 11 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 <strings.h> for ffs(). Patch by Perry
    Smith. Thank you. [Bug #6748]
Actions #4

Updated by kosaki (Motohiro KOSAKI) over 11 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) over 11 years ago

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

Updated by pedz (Perry Smith) over 11 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.

Actions #7

Updated by naruse (Yui NARUSE) over 11 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]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0