Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for building with IAR toolchain #1639

Merged
merged 14 commits into from Mar 18, 2023
Merged

Commits on Sep 12, 2022

  1. IAR declares strncasecmp in string.h not strings.h

    strings.h is not an ISO header file, so IAR generates fatal error Pe1696
    'cannot open source file "strings.h"'. Even though strncasecmp isn't an
    ISO C library function, IAR's runtime library defines it, though it
    declares it in string.h instead.
    Ben Avison committed Sep 12, 2022
    Copy the full SHA
    d28ff11 View commit details
    Browse the repository at this point in the history
  2. [rp2040] Remove non-portable return statements

    IAR generates error Pe118 'a void function may not return a value'.
    Ben Avison committed Sep 12, 2022
    Copy the full SHA
    e5355d0 View commit details
    Browse the repository at this point in the history
  3. [rp2040] Explicit cast value of hw_set_alias

    Some compilers don't support the GNU extension `typeof` so their definitions
    of `hw_set_alias` can't inherit their type from their argument, and the best
    we can do is have `hw_set_alias` act the same as `hw_set_alias_untyped`.
    This requires an explicit cast when the macro is used instead, otherwise
    IAR generates error Pe132 'expression must have pointer-to-struct-or-union
    type but it has type "void *"'.
    
    The same goes for `hw_clear_alias`.
    Ben Avison committed Sep 12, 2022
    Copy the full SHA
    6dfc857 View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2022

  1. Refactor pointer arithmetic on void*

    This is a GCC extension, illegal in ISO C. IAR generates errors Pa152
    'these operand types cannot be used here' and Pe852 'expression must be a
    pointer to a complete object type'.
    
    Replace with uint8_t*.
    Ben Avison committed Sep 13, 2022
    Copy the full SHA
    16518dc View commit details
    Browse the repository at this point in the history
  2. Remove unreachable code

    IAR generates warning Pe111 'statement is unreachable'. In a couple of
    cases, replace return statements with TU_ATTR_FALLTHROUGH; because some
    compilers apparently can't figure out that the return statements are
    unreachable but do whinge about an imagined fall-through without them!
    Ben Avison committed Sep 13, 2022
    Copy the full SHA
    65ba15c View commit details
    Browse the repository at this point in the history
  3. Don't assume ints automatically convert to enums

    IAR generates warning Pe188 'enumerated type mixed with another type'.
    Ben Avison committed Sep 13, 2022
    Copy the full SHA
    53f0d55 View commit details
    Browse the repository at this point in the history
  4. Don't assume different enum types can be combined

    IAR generates warning Pa089 'enumerated type mixed with another enumerated
    type'.
    Ben Avison committed Sep 13, 2022
    Copy the full SHA
    6a2d01b View commit details
    Browse the repository at this point in the history
  5. Remove unused static data

    This affects struct rspMsg in usbtmc_app.c (unconditionally) and uint8_t
    termChar in usbtmc_device.c (when NDEBUG is defined). IAR generates warning
    Pe550 'variable was set but never used'.
    Ben Avison committed Sep 13, 2022
    Copy the full SHA
    caff3b5 View commit details
    Browse the repository at this point in the history
  6. Move variable into its own curly-brace scope

    IAR generates warning Pe546 'transfer of control bypasses initialization of
    variable "invInvTag"'.
    Ben Avison committed Sep 13, 2022
    Copy the full SHA
    62d90c8 View commit details
    Browse the repository at this point in the history
  7. IAR doesn't support __attribute__((fallthrough))

    IAR generates warning Pa167 'the "fallthrough" attribute is not supported'.
    It doesn't generate warnings when one switch case falls through to another,
    so simply make TU_ATTR_FALLTHROUGH expand to an empty string.
    
    Also replace one instance of __attribute__ with the macro.
    Ben Avison committed Sep 13, 2022
    Copy the full SHA
    01edbb8 View commit details
    Browse the repository at this point in the history
  8. [rp2040] Wrap GCC pragmas in #ifdef __GNUC__

    IAR generates warning Pe161 'unrecognized #pragma'.
    Ben Avison committed Sep 13, 2022
    Copy the full SHA
    73f22e3 View commit details
    Browse the repository at this point in the history

Commits on Mar 17, 2023

  1. Copy the full SHA
    bdfcd50 View commit details
    Browse the repository at this point in the history

Commits on Mar 18, 2023

  1. minor clean up

    hathach committed Mar 18, 2023
    Copy the full SHA
    d919f10 View commit details
    Browse the repository at this point in the history
  2. more clean up

    hathach committed Mar 18, 2023
    Copy the full SHA
    9f54cc1 View commit details
    Browse the repository at this point in the history