-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Restore XCODE5 build #6226
Restore XCODE5 build #6226
Conversation
There are 6 commits in this PR with only 2 of them related to the change. Looks like it may need to be rebased. Also, the changes to the BEGIN/END macros need to consider that that the use of the macro is followed by a ';'. The expansion of the macro needs to consider this and make sure there are no compiler error/warnings for an extra ';' or a missing statement. These macros have not been modified in a very long time, so the issues related to the ';' may not be present in the currently supported compilers. |
I meant there to be 6 commits. Each of these 6 issues breaks the XCODE5 build, and the commit fixes it (albeit that some of the others are ostensibly 'wrong' and need fixing anyway, the other toolchains do not complain and XCODE5 does). As regards the macro expansion, I did not write it (though ofc I've offered it as I believe it's correct), I don't know if @mhaeuser has any time to comment? |
I agree all 6 commits are required. All good updates. do see multiple Signed-off-by. Could this be changed to single Signed-off-by and Co-authored-by tags? I looked at git history. The style of BEGIN()/END() has not changed since imported 17 years ago. I seem to recall the addition of the extra local variable was done to support the ';' at the end of the macro usage. Perhaps removing the extra do loop and just ending with the local variable being set to FALSE would be a more compatible change and address the compiler warning. |
Perhaps I can add: it's my belief that the EDIT: Reading the code carefully, prompted by your comment, I don't think there is an extra do loop, though it looks like it. The outer do loop is the standard idiom for a macro to end safely with respect to following semicolons, as required. That's unchanged. The inner do loop is new, but it's required as part of the fix to what's happening inside the outer do loop; and also looking at it carefully, I believe cannot be combined with the outer do loop (basically because https://stackoverflow.com/q/32334338). |
If we want to go for the simplest form of these macros with formatting added to increase readability it would be: #define DEBUG_CODE_BEGIN() \
do { \
if (DebugCodeEnabled ()) {
#define DEBUG_CODE_END() \
} \
} while (FALSE) In this form, if We we need is a form that will generate compiler error if |
@mdkinney Thanks for clearing that up! This actually makes a lot of sense. Yet, the parity behaviour I described applies as well - even if unintentionally at first - and I don't think this should be regressed upon. As such, I suggest to add some no-op statement like |
This is part of a sequence of commits to restore build on the XCODE5 toolchain. The definition is required on other toolchains, but on XCODE5 results in a macro redefined error (from the existing value 255) from /usr/include/stdint.h. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
174d76e
to
e11d501
Compare
Without these changes, we get the error: error: variable '__DebugCodeLocal' set but not used from the DebugLib.h DEBUG_CODE_BEGIN()/END() macros on XCODE5. Similarly, in NOOPT builds only, we get: error: variable '__PerformanceCodeLocal' set but not used from the PerformanceLib.h PERF_CODE_BEGIN()/END() macros on XCODE5. It is important to note that the previous code involving a local variable was intended to ensure correct behaviour of ; following the macros, in particular that ; should be required: - tianocore#6226 (comment) - tianocore#6226 (comment) This converted version repeats the standard do { ... } while (FALSE) idiom (which is already used in the END macro) to achieve the same affect. The modified versions work on all toolchains. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
Without this change we get: error: equality comparison with extraneous parentheses when building on XCODE5. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
REF: https://edk2.groups.io/g/devel/message/88179 Without this change, we get: fatal error: 'Availability.h' file not found when building on XCODE5. The workaround uses a define present in openssl/include/crypto/rand.h which modifies openssl behaviour on Apple only, causing the library to default to a non-system specific source of entropy in syscall_random() in rand_unix.c. Co-authored-by: Savva Mitrofanov <savvamtr@gmail.com> Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
Without this change we get: error: variable 'Index' set but not used when building on XCODE5. Co-authored-by: Savva Mitrofanov <savvamtr@gmail.com> Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
Without this change we get: error: equality comparison with extraneous parentheses when building with -D NETWORK_IP6_ENABLE on XCODE5. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
@mdkinney - Many thanks for your input on this PR. I've redone the DEBUG_CODE and PERF_CODE macros in a new way, avoiding the local variable entirely. I think it looks sane and safe, and addresses what you raised. It compiles and runs correctly on XCODE5 and under CI. I've also switched to Co-authored-by: tags as requested. |
Thanks for the updates. This version looks much cleaner than the original. |
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.
CryptoPkg part looks good to me.
Without these changes, we get the error: error: variable '__DebugCodeLocal' set but not used from the DebugLib.h DEBUG_CODE_BEGIN()/END() macros on XCODE5. Similarly, in NOOPT builds only, we get: error: variable '__PerformanceCodeLocal' set but not used from the PerformanceLib.h PERF_CODE_BEGIN()/END() macros on XCODE5. It is important to note that the previous code involving a local variable was intended to ensure correct behaviour of ; following the macros, in particular that ; should be required: - #6226 (comment) - #6226 (comment) This converted version repeats the standard do { ... } while (FALSE) idiom (which is already used in the END macro) to achieve the same affect. The modified versions work on all toolchains. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
Description
Drifts in EDK 2, submodules and Xcode itself mean the XCODE5 toolchain currently does not build out-of-the-box.
The changes required to fix this are small, and are included in this sequence of commits.
It should not be hard to achieve CI as well, but some quick experiments show that because I do not control https://dev.azure.com/tianocore/edk2-ci, nor mu_nasm nor mu_iasl, that I believe that as a contributor I cannot set up working CI (it may be possible to fake it by overriding settings in existing CI).
How This Was Tested
Build and run OVMF on XCODE5 (multiple versions and various -D options), and on Linux (multiple toolchains), locally. Also confirm building and running under existing CI for existing toolchains.
Integration Instructions
N/A