9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: comeau@panix.com (Greg Comeau)
To: 9fans@9fans.net
Subject: Re: [9fans] porting help please (gcc void pointer handling)
Date: Thu, 10 Sep 2009 09:29:22 +0000	[thread overview]
Message-ID: <h88ik0$qf9$1@panix3.panix.com> (raw)
In-Reply-To: <1d5d51400909090803n4c4d5b7ewba9dfe0573d02495@mail.gmail.com>

In article <1d5d51400909090803n4c4d5b7ewba9dfe0573d02495@mail.gmail.com>,
Fernan Bolando <fernanbolando@mailc.net> wrote:
>On Wed, Sep 9, 2009 at 4:36 PM, Greg Comeau<comeau@panix.com> wrote:
>> In article <1d5d51400909080844q1bee4c3s114ccc5e51ce52f5@mail.gmail.com>,
>> Fernan Bolando <fernanbolando@mailc.net> wrote:
>>>...error: initializer is not a constant: F0_Prelude_46primLeave
>>>--h file ---
>>>#define VAP_TAG =A01
>>>#define WORDSHIFT =A05
>>>#define WORDSIZE =A0 (1<<WORDSHIFT)
>>>#define WORDMASK =A0 (WORDSIZE-1)
>>>#define NS =A0 =A0 =A0 =A0 (WORDSIZE>>3)
>>>#define ZAP_BIT =A0 =A0(1L<<(WORDSIZE-1))
>>>-- c file ----
>>>unsigned F0_Prelude_46primLeave[] =3D {
>>> =A0CAPTAG(FN_Prelude_46primLeave,1)
>>>#ifdef PROFILE
>>>, useLabel(PROF_primLeave)
>>>, 0
>>>, 0
>>>, 0
>>>#endif
>>
>> The initializers to some things need to be constants.
>> In your case, it appears that either CAPTAG or useLabel (or both)
>> have ended up not being #define'd. =A0Probably the header they are
>> #define'd in is not being #include'd (you don't show it above,
>> but then you don't show enough of your code to even reproduce it).
>>
>> On a relate note, you can see the results of preprocessing
>> from pcc by using the -E and/or -P options, that way you
>> can see whether the macro ended up getting substituted
>> and what it was substituted to -- or not in your case.
>> Some compilers also have options which will emit the trail of
>> files #include'd but I don't see that option for pcc.
>
>gcc happily compiles a definition like
>#define CT_v249	((void*)startLabel+464)
>
>is it valid just to add to make the porting non-destructive?
>
>#ifdef Plan9
>#define void unsigned char
>#endif

It could be however, two issues:
1) I don't see how this has anything to do with the original problem
   (so I assume it doesn't).
2) There are other uses of void where doing that may not be what you
   want it to be:

    void foo(void);

becomes:

   unsigned char foo(unsigned char);

doubtful this is your intent for either the argument list or
return value.

However, it may or may not make sense for you to typedef a type
that is either void * or char *.  You don't make it clear what
problem is being solved by your question though, so it's unclear
if offering these ideas are just solutions looking for (non)problems
or not :)

Also, re non-destructive, it's unclear what you mean?
--
Greg Comeau / 4.3.10.1 with C++0xisms now in beta!
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout
World Class Compilers:  Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?



      parent reply	other threads:[~2009-09-10  9:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-09 15:03 Fernan Bolando
2009-09-09 15:35 ` erik quanstrom
2009-09-09 15:49   ` roger peppe
2009-09-10  9:30     ` Greg Comeau
2009-09-10  9:29   ` Greg Comeau
2009-09-10  9:40     ` erik quanstrom
2009-09-09 15:41 ` Charles Forsyth
     [not found] ` <1745bc1073a021783cf2ff8658d7ce47@quanstro.net>
2009-09-09 15:43   ` Fernan Bolando
2009-09-10  9:30     ` Greg Comeau
2009-09-09 16:08 ` Charles Forsyth
     [not found] ` <ace1f791830bf1d3f9d8c1e5cea17c14@terzarima.net>
2009-09-09 16:27   ` Fernan Bolando
2009-09-09 16:54     ` Charles Forsyth
2009-09-09 18:17     ` ron minnich
2009-09-11  1:45       ` Fernan Bolando
2009-09-10  9:31     ` Greg Comeau
2009-09-10  9:29 ` Greg Comeau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='h88ik0$qf9$1@panix3.panix.com' \
    --to=comeau@panix.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).