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

Warnings on iOS, macOS and tvOS #7880

Closed
paulocoutinhox opened this issue Jul 5, 2023 · 8 comments
Closed

Warnings on iOS, macOS and tvOS #7880

paulocoutinhox opened this issue Jul 5, 2023 · 8 comments

Comments

@paulocoutinhox
Copy link

Summary

Hi,

There are some warnings that break compilation for iOS, macOS and tvOS.

iOS:

CompileC /Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-iphoneos/Objects-normal/arm64/lms.o /Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library/lms.c normal arm64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'mbedcrypto' from project 'test')
    cd /Users/paulo/Developer/workspaces/cpp/cpp-http-test
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -ivfsstatcache /var/folders/0j/1vzxlz_d135_p0gs5jjc428c0000gn/C/com.apple.DeveloperTools/14.3.1-14E300c/Xcode/SDKStatCaches.noindex/iphoneos16.4-20E238-.sdkstatcache -target arm64-apple-ios11.0 -fmessage-length\=245 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O2 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-implicit-fallthrough -DCMAKE_INTDIR\=\"Release-iphoneos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk -fstrict-aliasing -Wdeprecated-declarations -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/Release/include -I/Users/paulo/Developer/workspaces/cpp/yasio -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/_deps/yasio-build -I/Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/include -I/Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-iphoneos/DerivedSources-normal/arm64 -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-iphoneos/DerivedSources/arm64 -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-iphoneos/DerivedSources -F/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/Release -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat\=2 -Wno-format-nonliteral -Werror -Wmissing-declarations -Wmissing-prototypes -Wdocumentation -Wno-documentation-deprecated-sync -Wunreachable-code -std\=c99 -MMD -MT dependencies -MF /Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-iphoneos/Objects-normal/arm64/lms.d --serialize-diagnostics /Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-iphoneos/Objects-normal/arm64/lms.dia -c /Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library/lms.c -o /Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-iphoneos/Objects-normal/arm64/lms.o
/Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library/lms.c:398:56: error: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Werror,-Wshorten-64-to-32]
        MERKLE_TREE_INTERNAL_NODE_AM(ctx->params.type) + q_leaf_identifier,
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library/lms.c:401:67: error: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Werror,-Wshorten-64-to-32]
    curr_node_id = MERKLE_TREE_INTERNAL_NODE_AM(ctx->params.type) +
                 ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
2 errors generated.

macOS:

CompileC /Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release/Objects-normal/x86_64/lms.o /Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library/lms.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'mbedcrypto' from project 'test')
    cd /Users/paulo/Developer/workspaces/cpp/cpp-http-test
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -ivfsstatcache /var/folders/0j/1vzxlz_d135_p0gs5jjc428c0000gn/C/com.apple.DeveloperTools/14.3.1-14E300c/Xcode/SDKStatCaches.noindex/macosx13.3-22E245-.sdkstatcache -target x86_64-apple-macos11.0 -fmessage-length\=245 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O2 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-implicit-fallthrough -DCMAKE_INTDIR\=\"Release\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/Release/include -I/Users/paulo/Developer/workspaces/cpp/yasio -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/_deps/yasio-build -I/Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/include -I/Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release/DerivedSources-normal/x86_64 -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release/DerivedSources/x86_64 -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release/DerivedSources -F/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/Release -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat\=2 -Wno-format-nonliteral -Werror -Wmissing-declarations -Wmissing-prototypes -Wdocumentation -Wno-documentation-deprecated-sync -Wunreachable-code -std\=c99 -MMD -MT dependencies -MF /Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release/Objects-normal/x86_64/lms.d --serialize-diagnostics /Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release/Objects-normal/x86_64/lms.dia -c /Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library/lms.c -o /Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release/Objects-normal/x86_64/lms.o
/Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library/lms.c:398:56: error: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Werror,-Wshorten-64-to-32]
        MERKLE_TREE_INTERNAL_NODE_AM(ctx->params.type) + q_leaf_identifier,
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library/lms.c:401:67: error: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Werror,-Wshorten-64-to-32]
    curr_node_id = MERKLE_TREE_INTERNAL_NODE_AM(ctx->params.type) +
                 ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
2 errors generated.

tvOS:

CompileC /Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-appletvos/Objects-normal/arm64/lms.o /Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library/lms.c normal arm64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'mbedcrypto' from project 'test')
    cd /Users/paulo/Developer/workspaces/cpp/cpp-http-test
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c -ivfsstatcache /var/folders/0j/1vzxlz_d135_p0gs5jjc428c0000gn/C/com.apple.DeveloperTools/14.3.1-14E300c/Xcode/SDKStatCaches.noindex/appletvos16.4-20L489-.sdkstatcache -target arm64-apple-tvos11.0 -fmessage-length\=245 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O2 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-implicit-fallthrough -DCMAKE_INTDIR\=\"Release-appletvos\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS16.4.sdk -fstrict-aliasing -Wdeprecated-declarations -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/Release/include -I/Users/paulo/Developer/workspaces/cpp/yasio -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/_deps/yasio-build -I/Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/include -I/Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-appletvos/DerivedSources-normal/arm64 -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-appletvos/DerivedSources/arm64 -I/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-appletvos/DerivedSources -F/Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/Release -Wall -Wextra -Wwrite-strings -Wpointer-arith -Wimplicit-fallthrough -Wshadow -Wvla -Wformat\=2 -Wno-format-nonliteral -Werror -Wmissing-declarations -Wmissing-prototypes -Wdocumentation -Wno-documentation-deprecated-sync -Wunreachable-code -std\=c99 -MMD -MT dependencies -MF /Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-appletvos/Objects-normal/arm64/lms.d --serialize-diagnostics /Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-appletvos/Objects-normal/arm64/lms.dia -c /Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library/lms.c -o /Users/paulo/Developer/workspaces/cpp/cpp-http-test/build/build/mbedcrypto.build/Release-appletvos/Objects-normal/arm64/lms.o
/Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library/lms.c:398:56: error: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Werror,-Wshorten-64-to-32]
        MERKLE_TREE_INTERNAL_NODE_AM(ctx->params.type) + q_leaf_identifier,
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/Users/paulo/Developer/workspaces/cpp/yasio/thirdparty/mbedtls/library/lms.c:401:67: error: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Werror,-Wshorten-64-to-32]
    curr_node_id = MERKLE_TREE_INTERNAL_NODE_AM(ctx->params.type) +
                 ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
2 errors generated.

System information

Mbed TLS version (number or commit id): db084d1
Operating system and version: macos ventura
Configuration (if not default, please attach mbedtls_config.h):
Compiler and options (if you used a pre-built binary, please indicate how you obtained it):
Additional environment information:

Expected behavior

Compile without warnings.

Actual behavior

Is compiling with warnings about type convertion.

Steps to reproduce

Build for iOS, tvOS and macOS.

Example:

rm -rf build/
mkdir -p build
cd build && cmake ../ -G Xcode -DCMAKE_TOOLCHAIN_FILE=cmake/ios.toolchain.cmake -DPLATFORM=TVOSCOMBINED && cmake --build . --config Release

Additional information

@daverodgman
Copy link
Contributor

@paul-elliott-arm I think you had a quick look at this - what were your findings?

@paul-elliott-arm
Copy link
Member

This is unfortunately a small chunk of work, these are not the only warnings caused by turning on that option.

I created an issue to track this, and added it to the tech debt backlog. Could one of that team perhaps prioritise this?

@daverodgman
Copy link
Contributor

Should we close this one then, and link it from the issue you raised?

@paul-elliott-arm
Copy link
Member

Closing as duplicate of #7813

@gilles-peskine-arm
Copy link
Contributor

gilles-peskine-arm commented Jul 6, 2023

I created an issue to track this, and added it to the tech debt backlog. Could one of that team perhaps prioritise this?

Without something in the CI to validate, this is low value, because this kind of warning tends to pop up again and again. We'd review a patch but not make one ourselves.

Hopefully in a few months our CI will have arm builds. That won't give us Apple device arm builds, but perhaps close enough to be useful.

@paulocoutinhox
Copy link
Author

Can you add something that disable the flag "-Werror"?
https://github.com/search?q=repo%3AMbed-TLS%2Fmbedtls%20werror&type=code

Can be a cmake option.

Thanks.

@gilles-peskine-arm
Copy link
Contributor

Can you add something that disable the flag "-Werror"?

I'm no cmake expert, but I think we already have that.

option(MBEDTLS_FATAL_WARNINGS "Compiler warnings treated as errors" ON)

@paulocoutinhox
Copy link
Author

Thanks, you are correct.

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

No branches or pull requests

4 participants