9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Federico G. Benavento" <benavento@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] pcc limitation?
Date: Sun,  7 Nov 2010 01:02:06 -0300	[thread overview]
Message-ID: <AANLkTi=6NRT9zMa8+p8mTw+uqi0PKf3wwwYnqfEA28-1@mail.gmail.com> (raw)
In-Reply-To: <4CD5F934.2080705@gmx.net>

the syntax (){} is for structures, like (Point){0, 0} or something,
so you don't need the braces there, just the cast

               .writearr       = (const unsigned char*)JEDEC_WREN,



On Sat, Nov 6, 2010 at 9:56 PM, Carl-Daniel Hailfinger
<c-d.hailfinger.devel.2006@gmx.net> wrote:
> Hi,
>
> any idea why the code below causes an error message from pcc? I'm trying
> to port flashrom to Plan 9, but I've been fighting the compiler for the
> last few hours.
> /usr/glenda/flashrom/test3.c:20[stdin:45] constructor must be a structure
> /usr/glenda/flashrom/test3.c:25[stdin:50] constructor must be a structure
>
> Regards,
> Carl-Daniel
>
> #include <stddef.h>
>
> #define JEDEC_WREN              0x06
> #define JEDEC_WREN_OUTSIZE      0x01
> #define JEDEC_CE_C7             0xc7
> #define JEDEC_CE_C7_OUTSIZE     0x01
>
> struct spi_command {
>        unsigned int writecnt;
>        unsigned int readcnt;
>        const unsigned char *writearr;
>        unsigned char *readarr;
> };
>
> void spi_chip_erase_c7(void)
> {
>        struct spi_command cmds[] = {
>        {
>                .writecnt       = JEDEC_WREN_OUTSIZE,
>                .writearr       = (const unsigned char[]){ JEDEC_WREN },
>                .readcnt        = 0,
>                .readarr        = NULL,
>        }, {
>                .writecnt       = JEDEC_CE_C7_OUTSIZE,
>                .writearr       = (const unsigned char[]){ JEDEC_CE_C7 },
>                .readcnt        = 0,
>                .readarr        = NULL,
>        }, {
>                .writecnt       = 0,
>                .writearr       = NULL,
>                .readcnt        = 0,
>                .readarr        = NULL,
>        }};
> }
>
>
>
>



-- 
Federico G. Benavento

  reply	other threads:[~2010-11-07  4:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-07  0:56 Carl-Daniel Hailfinger
2010-11-07  4:02 ` Federico G. Benavento [this message]
2010-11-07 12:32   ` Carl-Daniel Hailfinger
2010-11-07 14:46     ` erik quanstrom
2010-11-07 16:22       ` Carl-Daniel Hailfinger
2010-11-07 18:26         ` erik quanstrom
2010-11-07 19:36           ` Carl-Daniel Hailfinger
2010-11-07 19:42             ` erik quanstrom
2010-11-08  0:16               ` Carl-Daniel Hailfinger
2010-11-08  0:56                 ` erik quanstrom
2010-11-08  9:39                   ` Julius Schmidt
2010-11-08 14:00                     ` erik quanstrom
2010-11-08 15:17                       ` Anthony Sorace
2010-11-08  2:58         ` Russ Cox

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='AANLkTi=6NRT9zMa8+p8mTw+uqi0PKf3wwwYnqfEA28-1@mail.gmail.com' \
    --to=benavento@gmail.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).