-
Notifications
You must be signed in to change notification settings - Fork 95
Backport 1.1: IAR build fixes after 1.1.0 #708
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
base: tf-psa-crypto-1.1
Are you sure you want to change the base?
Changes from all commits
3c48006
e69d288
8baa0da
7b8db01
8168295
37a6dc8
692abdb
14a1c1e
94a7291
7b86815
678056f
4ecafcf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Bugfix | ||
| * Fix some IAR warnings. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,30 @@ | |
| * headers what we expect of them. */ | ||
| #include "tf_psa_crypto_platform_requirements.h" | ||
|
|
||
| #if defined(__IAR_SYSTEMS_ICC__) | ||
| /* In IAR (at least IAR 9.40 for Arm), enabling the C11 annex K functions | ||
| * (memset_s(), memcpy_s(), ...) with `#define __STDC_WANT_LIB_EXT1__ 1` | ||
| * causes the non-s functions to be declared as deprecatd. We want some | ||
| * s functions (specifically memset_s() and gmtime_s()), but we also want | ||
| * to be able to use the non-s functions. Try to hack around this: | ||
| * | ||
| * - tf_psa_crypto_platform_requirements.h enables annex K functions. | ||
| * - tf_psa_crypto_platform_requirements.h does not include any system | ||
| * header, so that a parent project such as Mbed TLS can declare | ||
| * more platform requirements after including only | ||
| * tf_psa_crypto_platform_requirements.h. | ||
| * - Then, here, we include a system header that causes the effects of | ||
| * `__STDC_WANT_LIB_EXT1__` to be analyzed. | ||
| * - These effects include the definition of the macro `__DEPREC`, but | ||
| * not yet the declaration of functions that use it (because stddef.h | ||
| * doesn't declare any affected function). We redeclare this macro | ||
| * to make the subsequent function declarations not be deprecated. | ||
| */ | ||
| #include <stddef.h> | ||
| #undef __DEPREC | ||
| #define __DEPREC | ||
| #endif | ||
|
Comment on lines
+48
to
+51
|
||
|
|
||
| /* From this point onwards, ensure we have the library configuration and | ||
| * the configuration-derived macros. */ | ||
| #include "tf-psa-crypto/build_info.h" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,7 +39,7 @@ static int verify_int(char *str, intmax_t *p_value) | |
| /* Limit the range to long: for large integers, the test framework will | ||
| * use expressions anyway. */ | ||
| long value = strtol(str, &end, 0); | ||
| if (errno == EINVAL || *end != '\0') { | ||
| if (*end != '\0' || end == str) { | ||
| mbedtls_fprintf(stderr, | ||
| "Expected integer for parameter and got: %s\n", str); | ||
| return KEY_VALUE_MAPPING_NOT_FOUND; | ||
|
Comment on lines
41
to
45
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,12 @@ | |
| #define __USE_MINGW_ANSI_STDIO 1 | ||
| #endif | ||
|
|
||
| #if defined(__IAR_SYSTEMS_ICC__) | ||
| /* With IAR, enable support for ::FILE functions in stdio.h. | ||
| */ | ||
| #define _DLIB_FILE_DESCRIPTOR 1 | ||
| #endif | ||
|
|
||
| #include "mbedtls/build_info.h" | ||
|
|
||
| /* Test code may use deprecated identifiers only if the preprocessor symbol | ||
|
|
@@ -55,6 +61,24 @@ __MBEDTLS_TEST_TEMPLATE__TEST_COMMON_HELPERS | |
| /* Test Suite Code */ | ||
|
|
||
|
|
||
| #if defined(__IAR_SYSTEMS_ICC__) | ||
| /* Suppress a very overeager warning from IAR: it dislikes a forward goto | ||
| * that bypasses the initialization of a variable, even if that variable | ||
| * is not used after the jump. (This is perfectly valid C; it would only | ||
| * be invalid C if jumping into a block from outside that block.) | ||
| */ | ||
| #pragma diag_suppress=Pe546 // transfer of control bypasses initialization | ||
|
|
||
| /* Temporarily suppress a perfectly reasonable warning from IAR that | ||
| * comes up very often in our unit tests: silent conversion of int to | ||
| * an enum type. | ||
| * | ||
| * Remove this when https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/707 | ||
| * is fixed. | ||
| */ | ||
| #pragma diag_suppress=Pe188 // enumerated type mixed with another type | ||
| #endif | ||
|
Comment on lines
+64
to
+80
|
||
|
|
||
| #define TEST_SUITE_ACTIVE | ||
|
|
||
| __MBEDTLS_TEST_TEMPLATE__FUNCTIONS_CODE | ||
|
|
@@ -219,7 +243,6 @@ static int check_test(size_t func_idx) | |
| return ret; | ||
| } | ||
|
|
||
|
|
||
| __MBEDTLS_TEST_TEMPLATE__PLATFORM_CODE | ||
|
|
||
| #line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'deprecatd' to 'deprecated'.