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

Default to stricter warning flags in CMakeLists.txt #9456

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

sezrab
Copy link
Contributor

@sezrab sezrab commented Aug 7, 2024

As suggested in #9317, added -std=c99 -pedantic to CMAKE_C_FLAGS in CmakeLists.txt. This has introduced some pointer conversion errors, which are specified below.

metatest.c

/var/lib/build/programs/test/metatest.c:131:34: error: format specifies type 'void *' but the argument has type 'volatile char *' [-Werror,-Wformat-pedantic]
    mbedtls_printf("%p -> %u\n", p, (unsigned) *p);

dlopen.c

/var/lib/build/programs/test/dlopen.c:50:18: error: initializing 'const int *(*)(void)' with an expression of type 'void *' converts between void pointer and function pointer [-Werror,-Wpedantic]
    const int *(*ssl_list_ciphersuites)(void) =
                   
/var/lib/build/programs/test/dlopen.c:78:18: error: initializing 'const int *(*)(void)' with an expression of type 'void *' converts between void pointer and function pointer [-Werror,-Wpedantic]
    const int *(*md_list)(void) =

test_suite_platform.function

/var/lib/build/tests/suites/test_suite_platform.function:130:45: error: format specifies type 'void *' but the argument has type 'unsigned char *' [-Werror,-Wformat-pedantic]
    mbedtls_printf("calloc pointer : %p\n", buf);

PR checklist

Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line.
If the provided content is part of the present PR remove the # symbol.

  • changelog not required
  • development PR provided
  • framework PR not required
  • 3.6 PR todo
  • 2.28 PR not required?
  • tests not required

Signed-off-by: Sam Berry <sam.berry@arm.com>
Fixes pointer conversion errors introduced from -Wpedantic -Werror

Signed-off-by: Sam Berry <sam.berry@arm.com>
@sezrab sezrab added needs-work component-test Test framework and CI scripts labels Aug 8, 2024
Fixes warning (now (error) where format specifies type 'void *' but the
argument has type 'volatile char *'

Signed-off-by: Sam Berry <sam.berry@arm.com>
Signed-off-by: Sam Berry <sam.berry@arm.com>
@sezrab sezrab force-pushed the default_to_stricter_warning_flags_cmake-development branch from c39d862 to 91fa58f Compare August 9, 2024 09:17
@gilles-peskine-arm gilles-peskine-arm added the priority-medium Medium priority - this can be reviewed as time permits label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component-test Test framework and CI scripts needs-work priority-medium Medium priority - this can be reviewed as time permits
Projects
Status: Needs adopter
Development

Successfully merging this pull request may close these issues.

2 participants