[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openocd-development
Subject:    Re: [OpenOCD-devel] Compilation broken on cygwin/newlib
From:       Antonio Borneo <borneo.antonio () gmail ! com>
Date:       2020-03-26 22:47:38
Message-ID: CAAj6DX1bfBysYkSPWri9YDZsF8secAraC7uh1LQSWKPp6C9xjg () mail ! gmail ! com
[Download RAW message or body]

I have just pushed a possible fix as http://openocd.zylin.com/5545
Would be good to have feedback from Ake and also if there is any other
issue in his build environment.
I'm trying to figure out if we can test this case without newlib ...

Antonio

On Thu, Mar 26, 2020 at 10:31 PM John S via OpenOCD-devel
<openocd-devel@lists.sourceforge.net> wrote:
>
> I think it means array ELEMENT, not subscript, has type char.
>
> (Also, once upon a time char widened to int...)
>
> John
>
>
> On Thursday, 26 March 2020, 21:23:41 GMT, Åke Rehnman <ake.rehnman@gmail.com> wrote:
>
>
> Hello all,
>
> newlib forces parameter c to isalnum(c) to be unsigned char or int.
>
> BR
>
> /Ake
>
> In file included from ../src/helper/system.h:29,
>                  from ./config.h:338,
>                  from ../src/flash/nor/nrf5.c:22:
> ../src/flash/nor/nrf5.c: In function ‘nrf5_info_variant_to_str':
> ../src/flash/nor/nrf5.c:575:16: error: array subscript has type ‘char'
> [-Werror=char-subscripts]
>   575 |  if (isalnum(bf[0]) && isalnum(bf[1]) && isalnum(bf[2]) &&
> isalnum(bf[3]))
>       |              ~~^~~
> ../src/flash/nor/nrf5.c:575:34: error: array subscript has type ‘char'
> [-Werror=char-subscripts]
>   575 |  if (isalnum(bf[0]) && isalnum(bf[1]) && isalnum(bf[2]) &&
> isalnum(bf[3]))
>       |                                ~~^~~
> ../src/flash/nor/nrf5.c:575:52: error: array subscript has type ‘char'
> [-Werror=char-subscripts]
>   575 |  if (isalnum(bf[0]) && isalnum(bf[1]) && isalnum(bf[2]) &&
> isalnum(bf[3]))
>       |                                                  ~~^~~
> ../src/flash/nor/nrf5.c:575:70: error: array subscript has type ‘char'
> [-Werror=char-subscripts]
>   575 |  if (isalnum(bf[0]) && isalnum(bf[1]) && isalnum(bf[2]) &&
> isalnum(bf[3]))
> | ~~^~~
>
> from ctype.h:
>
> /* These macros are intentionally written in a manner that will trigger
>    a gcc -Wall warning if the user mistakenly passes a 'char' instead
>    of an int containing an 'unsigned char'.  Note that the sizeof will
>    always be 1, which is what we want for mapping EOF to __CTYPE_PTR[0];
>    the use of a raw index inside the sizeof triggers the gcc warning if
>    __c was of type char, and sizeof masks side effects of the extra __c.
>    Meanwhile, the real index to __CTYPE_PTR+1 must be cast to int,
>    since isalpha(0x100000001LL) must equal isalpha(1), rather than being
>    an out-of-bounds reference on a 64-bit machine.  */
>
>
>
>
> _______________________________________________
> OpenOCD-devel mailing list
> OpenOCD-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openocd-devel
> _______________________________________________
> OpenOCD-devel mailing list
> OpenOCD-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openocd-devel


_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic