Skip to content

Fix inttypes inclusion #4

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

Merged
merged 1 commit into from
Nov 29, 2018
Merged

Fix inttypes inclusion #4

merged 1 commit into from
Nov 29, 2018

Conversation

0xc0170
Copy link
Contributor

@0xc0170 0xc0170 commented Nov 29, 2018

__STDC_FORMAT_MACROS needs to be added for format specifiers like PRId32
IAR/ARMCC do not define it

@0xc0170
Copy link
Contributor Author

0xc0170 commented Nov 29, 2018

Important fix for 5.11rc1, please review

Note, compile example with ARMCC/IAR as there are differences sometimes

@kjbracey
Copy link

As a general rule, I'd be inclined to stick that define at the very top of the file. There's a potential problem if "psa/crypto.h" were to include <inttypes.h> itself - your second include wouldn't do anything. If that macro is required, it has to be set before the first include.

(This is unlike NDEBUG, which are you are allowed to change and reinclude <assert.h> to flip assert behaviour back and forth).

That macro is dumb, and has been disowned by all standards bodies involved - toolchains should have been revised to not care about it.

@0xc0170
Copy link
Contributor Author

0xc0170 commented Nov 29, 2018

I would expect "psa/crypto.h" to do the same if there would do any magic related to this macro. OK, will do add it just in case. rebase incoming

__STDC_FORMAT_MACROS needs to be added for format specifiers like PRId32
IAR/ARMCC do not define it
@0xc0170
Copy link
Contributor Author

0xc0170 commented Nov 29, 2018

Fixed

@kjbracey
Copy link

Unfortunately it might be using only the bits of the header that don't need the macro, so not have had the need to set it.

Certainly I do tend to add the macro myself in any header even if I don't need it just to avoid that trap - eg ns_types.h, but can't rely on what random headers do.

@0xc0170
Copy link
Contributor Author

0xc0170 commented Nov 29, 2018

@Patater As this fixes the problem. I'll merge this and restart testing for the example inclusion (this should be safe to merge now).

@0xc0170 0xc0170 merged commit 2f78c5b into ARMmbed:master Nov 29, 2018
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.

2 participants