Ticket #647 (closed patch: fixed)

Opened 13 years ago

Last modified 13 years ago

[PATCH] src/call/pcc.c compile on hpux

Reported by: rrauenza Owned by: Infinoid
Priority: normal Milestone:
Component: none Version:
Severity: medium Keywords:
Cc: Language:
Patch status: applied Platform:

Description

hpux 11.23, hp compiler, to be specific. I was trying to build rakudo on HPUX.

without this patch, an argument assertion fails to compile because the argument isn't evaluatable (did I make up that word?). It is the va_list which isn't a scalar value. I saw in other functions that the va_list wasn't asserted, so I removed it.

Index: src/call/pcc.c
===================================================================
--- src/call/pcc.c      (revision 38492)
+++ src/call/pcc.c      (working copy)
@@ -310,8 +310,7 @@
        PARROT_ASSERT_ARG(interp) \
     || PARROT_ASSERT_ARG(ctx) \
     || PARROT_ASSERT_ARG(indexes) \
-    || PARROT_ASSERT_ARG(ret_x) \
-    || PARROT_ASSERT_ARG(returns)
+    || PARROT_ASSERT_ARG(ret_x) 
 #define ASSERT_ARGS_set_retval_util __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp) \
     || PARROT_ASSERT_ARG(sig) \

Change History

in reply to: ↑ description   Changed 13 years ago by jkeenan

Replying to rrauenza:

hpux 11.23, hp compiler, to be specific. I was trying to build rakudo on HPUX. without this patch, an argument assertion fails to compile

Could you post the output you got before you applied the patch? It would be helpful to see the failures you got.

Thank you very much.
kid51

follow-up: ↓ 5   Changed 13 years ago by rrauenza

"src/call/pcc.c", line 2475: error #2041: expression must have arithmetic or

pointer type

ASSERT_ARGS(set_context_sig_returns_varargs)

1 error detected in the compilation of "src/call/pcc.c". make: *** [src/call/pcc.o] Error 2

If I preprocess it, and split the assert across more than one line,

smoketst@… $ cc bar3.c "src/call/pcc.c", line 951: warning #2940-D: missing return statement at end

of non-void function "Parrot_fetch_arg"

}

"src/call/pcc.c", line 2479: error #2041: expression must have arithmetic or

pointer type

((returns) ? (0) : (Parrot_confess("returns", "src/call/pcc.c", 2475), 0)) ;

1 error detected in the compilation of "bar3.c". smoketst@… $

  Changed 13 years ago by rrauenza

Let's try that again

smoketst@hairball.cup.hp.com $ cc bar3.c
"src/call/pcc.c", line 951: warning #2940-D: missing return statement at end
          of non-void function "Parrot_fetch_arg"
  }
  ^

"src/call/pcc.c", line 2479: error #2041: expression must have arithmetic or
          pointer type
       || ((returns) ? (0) : (Parrot_confess("returns", "src/call/pcc.c", 2475), 0)) ;
           ^

1 error detected in the compilation of "bar3.c".
smoketst@hairball.cup.hp.com $ 

  Changed 13 years ago by rrauenza

Returns is the va_list:

static void
set_context_sig_returns_varargs(Parrot_Interp interp, Parrot_Context *ctx,
    opcode_t * *indexes, const char *ret_x, va_list returns)

in reply to: ↑ 2   Changed 13 years ago by Infinoid

  • owner set to Infinoid

Replying to rrauenza:

"src/call/pcc.c", line 2475: error #2041: expression must have arithmetic or pointer type ASSERT_ARGS(set_context_sig_returns_varargs)

Thanks for the info. I would be rather curious to see what the preprocessor output of that looks like (if your compiler has an equivalent to gcc -E), but it isn't very important... I think I already know how to get things building for you.

The ASSERT_ARGS stuff is a bit of a hack to keep us programmers honest, and it is rather gcc-specific. We are explicitly disabling it for the MSVC compiler with an #ifdef _MSC_VER, you can see this in include/parrot/exceptions.h. Is there a compiler-specific define we can use to skip it on the HPUX compiler, too?

Mark

follow-up: ↓ 7   Changed 13 years ago by rrauenza

int _ASSERT_ARGS_CHECK = ((interp) ? (0) : (Parrot_confess("interp", "src/call/pcc.c", 2475), 0)) 
     || ((ctx) ? (0) : (Parrot_confess("ctx", "src/call/pcc.c", 2475), 0)) 
     || ((indexes) ? (0) : (Parrot_confess("indexes", "src/call/pcc.c", 2475), 0)) 
     || ((ret_x) ? (0) : (Parrot_confess("ret_x", "src/call/pcc.c", 2475), 0)) 
     || ((returns) ? (0) : (Parrot_confess("returns", "src/call/pcc.c", 2475), 0)) ;

Looks like va_list is pretty opaque..

bar3.c is the -E version:

$ grep va_list bar3.c
  typedef __va_list__ __va_list;
  typedef __va_list__ va_list;      

The default #defines for the HP compiler are

smoketst@hairball.cup.hp.com $ cc -v foo.c 
 /opt/aCC/lbin/ecom -architecture 32 -ia64abi all -ext on -lang c -exception off 
-sysdir /usr/include -inline_power 1 -link_type dynamic -fpeval float -fpevaldec 
_Decimal32 -tls_dyn on -target_os 11.23 --sys_include /usr/include -D_BIND_LIBCALLS 
-D_Math_errhandling=MATH_ERREXCEPT -D__hpux -D__unix -D__ia64=1 -D__ia64__=1 
-D_BIG_ENDIAN=1 -D_ILP32 -D__HP_cc=62000 -D__STDC_EXT__ -D_HPUX_SOURCE 
-D_INCLUDE_LONGLONG -D_INLINE_ASM -D_FLT_EVAL_METHOD=0 -D_DEC_EVAL_METHOD=0 -ucode 
hdriver=optlevel%1% -plusolistoption -Ol06all! -plusolistoption -Ol13moderate! 
-plusooption 
-Oq01,al,ag,cn,sz,ic,vo,Mf,Po,es,rs,Rf,Pr,sp,in,cl,om,vc,pi,fa,pe,rr,pa,pv,nf,cp,lx,Pg,ug,lu,lb,uj,dn,sg,pt,kt,em,np,ar,rp,dl,fs,bp,wp,pc,mp,lr,cx,cr,pi,so,Rc,fa,ft,fe,ap,st,lc,Bl,sr,Qs,do,ib,pl,sd,ll,rl,dl,Lt,ol,fl,lm,ts,rd,dp,If! 
foo.c

The one you probably want to use is:

-D__HP_cc

The only compilation problem I've seen is with the asserting of the va_list. And only in that one function. There are lots of other parrot functions that take a va_list that isn't asserted in that file.

Only other thing to mention is that by default we are not C99 compliant, but there are compiler options to turn that on. Not really relevant for this error though.

Rich

in reply to: ↑ 6   Changed 13 years ago by Infinoid

Replying to rrauenza:

The only compilation problem I've seen is with the asserting of the va_list. And only in that one function. There are lots of other parrot functions that take a va_list that isn't asserted in that file.

Thanks. So it sounds like ASSERT_ARGS works fine with the HPUX compiler anyway... it's just that our code assumes va_list is some sort of pointer type, which on your platform, it isn't. (For the record, we have a similar issue on the netbsd/alpha platform, and we should find a more general fix for that issue.)

Only other thing to mention is that by default we are not C99 compliant, but there are compiler options to turn that on. Not really relevant for this error though.

Ok. We're targeting C89 for this project, in any case, so that shouldn't be an issue. (If it is, that means we have a bug.)

r38610 changes the ASSERT_ARGS-blacklisted-on-MSVC logic to whitelisted-on-gcc logic, so the latest svn should build correctly for you. It won't fix the non-pointer va_list issue, but it works around it by disabling the seatbelt. (But gcc on HPUX would still fail.)

  Changed 13 years ago by Infinoid

  • status changed from new to closed
  • resolution set to fixed
  • patch set to applied

Thanks, fixed in r38900. Note this was a holdover from #573; both tickets should be fixed now.

Note: See TracTickets for help on using tickets.