Re: [PATCH 1/1] libc: Added implementations and prototypes for
Corinna Vinschen <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <YPkkX5uM/[email protected]> |
Hi Matt,
On Jul 22 07:14, Matthew Joyce wrote:
> Hi Corinna,
>
> I've made the changes you recommended but I'm running into a problem
> with the definition of SIG2STR_MAX. You suggested:
>
> #if __STDINT_EXP(INT_MAX) > 0x7fff
> #define SIG2STR_MAX (sizeof ("RTMAX+") + sizeof ("4294967295") - 1)
> #else #define SIG2STR_MAX (sizeof ("RTMAX+") + sizeof ("65535") - 1)
These are actually two lines, right? It's just a copy/paste glitch,
I guess.
> #endif
>
> I've tried it both in newlib and natively but I get the error:
> " missing binary operator before token '(' "
> (In the first line of the block)
I hacked a STC:
----------------------------------
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#if __STDINT_EXP(INT_MAX) > 0x7fff
#define SIG2STR_MAX (sizeof ("RTMAX+") + sizeof ("4294967295") - 1)
#else
#define SIG2STR_MAX (sizeof ("RTMAX+") + sizeof ("65535") - 1)
#endif
void
foo (int sig, char *out)
{
char buf[SIG2STR_MAX];
if (sig > SIG2STR_MAX)
return;
snprintf (buf, SIG2STR_MAX, "FOO+%d", sig);
memcpy (out, buf, SIG2STR_MAX);
}
----------------------------------
$ gcc -g -O2 -c -Wall foo.c
No error or warning is generated, so I'm puzzled about your problem.
Would you mind to paste the affected code snippet and the full gcc error
output?
Corinna