Skip to content

C89 compliance items#10858

Open
anhu wants to merge 6 commits into
wolfSSL:masterfrom
anhu:89compl
Open

C89 compliance items#10858
anhu wants to merge 6 commits into
wolfSSL:masterfrom
anhu:89compl

Conversation

@anhu

@anhu anhu commented Jul 7, 2026

Copy link
Copy Markdown
Member

Fixes ZD 22098

  • Flexible array members ("type name[];") fixup
  • avoid empty asn_orig.c when building standalone
  • avoid trailing comma on the last enumerator
  • drop some consts to match function prototypes

- Flexible array members ("type name[];") fixup
- avoid empty asn_orig.c when building standalone
- avoid trailing comma on the last enumerator
- drop some consts to match function prototypes
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

gcc-arm-cortex-m0plus

  • FLASH: .text +64 B (+0.1%, 64,155 B / 262,144 B, total: 24% used)

gcc-arm-cortex-m3

  • FLASH: .text +268 B (+0.2%, 122,449 B / 262,144 B, total: 47% used)

gcc-arm-cortex-m4

  • FLASH: .rodata.CSWTCH.1 +4 B, .rodata.str1.1 +58 B, .text +320 B (+0.2%, 200,284 B / 262,144 B, total: 76% used)

gcc-arm-cortex-m4-baremetal

  • FLASH: .text +64 B (+0.1%, 66,763 B / 262,144 B, total: 25% used)

gcc-arm-cortex-m4-crypto-only

  • FLASH: .rodata.CSWTCH.1 +4 B, .rodata.str1.1 +58 B, .text +64 B (+0.1%, 174,440 B / 262,144 B, total: 67% used)

gcc-arm-cortex-m4-dtls13

  • FLASH: .text +192 B (+0.1%, 180,824 B / 1,048,576 B, total: 17% used)

gcc-arm-cortex-m4-min-ecc

  • FLASH: .text +64 B (+0.1%, 61,741 B / 262,144 B, total: 24% used)

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .rodata +248 B, .text +1,024 B (+0.2%, 770,764 B / 1,048,576 B, total: 74% used)

gcc-arm-cortex-m4-pkcs7

  • FLASH: .rodata.CSWTCH.1 +4 B, .rodata.str1.1 +58 B (+0.0%, 212,268 B / 262,144 B, total: 81% used)

gcc-arm-cortex-m4-pq

  • FLASH: .rodata +60 B, .text +192 B (+0.1%, 279,236 B / 1,048,576 B, total: 27% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .rodata +56 B, .text +256 B (+0.1%, 324,896 B / 1,048,576 B, total: 31% used)

gcc-arm-cortex-m4-sp-math

  • FLASH: .text +64 B (+0.1%, 61,741 B / 262,144 B, total: 24% used)

gcc-arm-cortex-m4-tls12

  • FLASH: .text +256 B (+0.2%, 123,213 B / 262,144 B, total: 47% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .rodata.CSWTCH.1 +4 B, .rodata.str1.1 +58 B, .text +128 B (+0.1%, 235,918 B / 262,144 B, total: 90% used)

gcc-arm-cortex-m7

  • FLASH: .rodata.CSWTCH.1 +4 B, .rodata.str1.1 +58 B, .text +320 B (+0.2%, 200,220 B / 262,144 B, total: 76% used)

gcc-arm-cortex-m7-pq

  • FLASH: .rodata +60 B, .text +192 B (+0.1%, 279,812 B / 1,048,576 B, total: 27% used)

gcc-arm-cortex-m7-tls13

  • FLASH: .rodata.CSWTCH.1 +4 B, .rodata.str1.1 +58 B, .text +192 B (+0.1%, 235,982 B / 262,144 B, total: 90% used)

linuxkm-pie

  • Data: __patchable_function_entries +136 B (+0.5%, 25,456 B)

linuxkm-standard

  • Data: __patchable_function_entries +160 B (+0.3%, 48,112 B)

stm32-sim-stm32h753

  • FLASH: .text +320 B (+0.2%, 183,396 B / 2,097,152 B, total: 9% used)

@anhu anhu requested review from douzzer and wolfSSL-Bot July 7, 2026 18:29
@anhu anhu self-assigned this Jul 7, 2026
Comment thread src/internal.c Outdated
@anhu anhu requested a review from douzzer July 7, 2026 19:06
@anhu anhu assigned wolfSSL-Bot and unassigned anhu Jul 8, 2026
dgarske
dgarske previously approved these changes Jul 8, 2026
Comment thread wolfssl/wolfcrypt/types.h Outdated
Comment on lines +224 to +231
#if defined(WOLF_C89)
/* C99 flexible array member, or the C89 "struct hack" fallback.
* See http://c-faq.com/struct/structhack.html */
#define WC_FLEXIBLE_ARRAY_MEMBER 1
#else
/* empty: C99 flexible array member */
#define WC_FLEXIBLE_ARRAY_MEMBER
#endif

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be named WC_FLEXIBLE_ARRAY_SIZE. It also needs override capability. The setup for it in WolfSentry is

#if defined(WOLFSENTRY_FLEXIBLE_ARRAY_SIZE)
    /* keep override value. */
#elif defined(__STRICT_ANSI__) || defined(WOLFSENTRY_PEDANTIC_C)
    #define WOLFSENTRY_FLEXIBLE_ARRAY_SIZE 1
#elif defined(__GNUC__) && !defined(__clang__)
    #define WOLFSENTRY_FLEXIBLE_ARRAY_SIZE
    /*!< \brief Value appropriate as a size for an array that will be allocated to a variable size.  Built-in value usually works. */
#else
    #define WOLFSENTRY_FLEXIBLE_ARRAY_SIZE 0
#endif

and that's my recommendation here too, with || defined(WOLF_C89) added to the __STRICT_ANSI__ condition.

@douzzer douzzer assigned anhu and unassigned douzzer Jul 8, 2026
douzzer
douzzer previously approved these changes Jul 8, 2026

@douzzer douzzer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note a whitespace flub in the reindented comments in the struct ExternalTicket definition -- but def not worth holding up the PR for it.

@anhu

anhu commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

Fixed the whitespace.

@dgarske dgarske removed the request for review from wolfSSL-Bot July 8, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants