public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: Ramon Bertran Monfort <rbertran@ac.upc.edu>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Stricter requirements for function main signature
Date: Tue, 08 Apr 2008 14:56:00 -0000	[thread overview]
Message-ID: <47FB7027.1040309@redhat.com> (raw)
In-Reply-To: <20080408102154.GA31292@rbertran-workstation>

Ramon Bertran Monfort wrote:
> Well,
> first of all, thanks for answering.
> 
>> Why don't you just define main() correctly?  argv should be 'char **', 
>> and envp should probably be 'char **'.  How can you possibly have an 
>> envp that's a long long unsigned int?
> 
> If a follow the SDK3.0 programming guide, it tells me that the spe main 
> function has three parameters: the spe id, and two pointers to application 
> specific data. The last two are optional.

But you passed not a pointer but a long long unsigned int.  Why not pass a
pointer instead of a long long unsigned int, especially since that's
what the programming guide tells you to do?

> I can try to change the signature to the 'correctly' one ... but doing this 
> will break the spe run-time probably. (I've to experiment with this).  
> Anyway, sometimes I use three parameters witch is not allowed with the 
> 'correct' strict signature.

g++ allows the third argument to be a pointer.

> I know that there are workarounds for solving this issues, but I'm 
> wondering if there is any gcc flag to relax this strict condition. It would 
> be easy to port applications to gcc 4.3.0 such as the Cell application 
> which changing the code is not as straightforward as the example shown in 
> http://www.gnu.org/software/gcc/gcc-4.3/porting_to.html .

>> Also, what are the compiler options you're using?
> 
> I guess that does not matter. I'm using just 'spu-g++ -O2' for testing.

Ah, OK.  It seems that you have been caught by a version of gcc that treats
this as an error rather than a warning.  I'm not sure exactly when this
changed, but the current development version has a warning, not an error.

Andrew.

  reply	other threads:[~2008-04-08 13:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-07 18:37 Ramon Bertran Monfort
2008-04-08 10:22 ` Andrew Haley
2008-04-08 13:17   ` Ramon Bertran Monfort
2008-04-08 14:56     ` Andrew Haley [this message]
2008-04-08 18:08       ` Ramon Bertran Monfort
2008-04-08 16:34 ` Jim Wilson
2008-04-08 18:33   ` Ramon Bertran Monfort

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=47FB7027.1040309@redhat.com \
    --to=aph@redhat.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=rbertran@ac.upc.edu \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).