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

compilers/clike: Speedup cross_compute_int #13926

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sp1ritCS
Copy link
Contributor

Expand the expression passed into cross_compute_int using the preprocessor first and then try to evaluate the expanded expression using the host machine compiler and test if the result is valid.

See #13910 for previous discussion

#include <stdio.h>
#include <stdint.h>
int main(void) {{ int expression = {expanded}; printf("%d", expression); return 0; }}'''
run = env.coredata.compilers[mesonlib.MachineChoice.BUILD]['c'].run(evaluate_expanded, env)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error cross-compiling the common: 38 alignment test to armhf:

  File "/__w/meson/meson/mesonbuild/compilers/mixins/clike.py", line 485, in cross_compute_int
    run = env.coredata.compilers[mesonlib.MachineChoice.BUILD]['c'].run(evaluate_expanded, env)
KeyError: 'c'

This also points out another issue: you have to use the build compiler for the same language as the current compiler. Not 'c' unconditionally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not only that but I'll also have to check that self.language for the build machine is actually found.

Theoretically I should probably use compilers.detect_compiler_for(env, self.language, MachineChoice.BUILD, False, <subproject>) but I do not have subproject available at this point

Expand the expression passed into cross_compute_int using the
preprocessor first and then try to evaluate the expanded expression
using the host machine compiler and test if the result is valid.
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.

3 participants