Skip to content

Fix LTO build failures due to duplicate local types #9158

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
Dec 20, 2018

Conversation

davidsaada
Copy link
Contributor

Description

This PR fixes failures in build when using LTO (Link Time Optimizations) in the GCC_ARM toolchain. Failures are caused by local types having similar names and different content (like structures with similar names and different fields). Solution is achieved by wrapping these types with the anonymous namespace.

Resolves #9099.

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

@0xc0170 0xc0170 requested a review from a team December 19, 2018 14:44
@pan-
Copy link
Member

pan- commented Dec 19, 2018

It might be useful to extend the code guidelines to mention that data structures local to a C++ files should be declared inside an anonymous namespace. @kjbracey-arm What do you think ?

@kjbracey
Copy link
Contributor

Absolutely. It's a "must", rather than a "should", even.

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 20, 2018

CI started

@mbed-ci
Copy link

mbed-ci commented Dec 20, 2018

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 1
Build artifacts

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 20, 2018

This is ready for integration

I created tracking issue for docs update ARMmbed/mbed-os-5-docs#884

@0xc0170 0xc0170 merged commit cc2e15c into ARMmbed:master Dec 20, 2018
@davidsaada davidsaada deleted the david_lto_dup_types branch January 14, 2019 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Identically names structs in different files
6 participants