Issue #8216 has been updated by robertgrimm (Robert Grimm).


Ruby 1.9.3's mkmf.rb generates an incorrect conftest.c with this change and results in a "main is undeclared" error.

As is, 1.9.3 will generate something like:
#include "ruby.h"                                                                                                                                                                                                                      
                                                                                                                                                                                                                                  
/*top*/                                                                                                                                                                                                                                
int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }                                                                                                                                                                  
int main(int argc, char **argv)                                                                                                                                                                                                        
{                                                                                                                                                                                                                                      
  if (argc > 1000000) {                                                                                                                                                                                                                
    printf("%p", &t);                                                                                                                                                                                                                  
}                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                     
  return 0;                                                                                                                                                                                                                            
}

The t() function should be defined under main's definition and t() should be declared at the top.  Ruby 2.0.0's mkmf.rb generates something like (which is correct):
#include "ruby.h"                                                                                                                                                                                                                      
                                                                                                                                                                                                                                  
/*top*/                                                                                                                                                                                                                                
extern int t(void);                                                                                                                                                            
int main(int argc, char **argv)                                                                                                                                                                                                        
{                                                                                                                                                                                                                                      
  if (argc > 1000000) {                                                                                                                                                                                                                
    printf("%p", &t);                                                                                                                                                                                                                  
}                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                     
  return 0;                                                                                                                                                                                                                            
}
int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; } 
----------------------------------------
Backport #8216: Request of backport of fix for Bug #8169
https://bugs.ruby-lang.org/issues/8216#change-41616

Author: edelsohn (David Edelsohn)
Status: Closed
Priority: Normal
Assignee: usa (Usaku NAKAMURA)
Category: 
Target version: 


Changesets r39958 and r39989 are needed on Ruby 1.9.3 branch for mkmf to properly test features on AIX.


-- 
http://bugs.ruby-lang.org/