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

Feature Request: compiler.compute_int() #435

Closed
tp-m opened this issue Mar 6, 2016 · 2 comments
Closed

Feature Request: compiler.compute_int() #435

tp-m opened this issue Mar 6, 2016 · 2 comments

Comments

@tp-m
Copy link
Member

tp-m commented Mar 6, 2016

Need the ability to extract the int values of certain defines that can be determined at compile time, basically a more generic variant of what the compiler.sizeof() check does.

If we're not cross-compiling, the code is pretty much exactly the same.

If we're cross-compiling we'd have to do something slightly different, but it should still be possible. The current code just tries to compile code with values from 1 to 1024 in a loop in such a way that compilation will fail if it's not the value, but it's probably not a good idea to try all values from 0 to MAXINT. It should be possible to bisect though by using code such as

#if FOO > 144
#error "larger"
#endif

One could check what AC_COMPUTE_INT() does if one can find the actual implementation.

@nirbheek nirbheek added this to the 0.37.0 milestone Nov 11, 2016
@nirbheek nirbheek modified the milestones: 0.37.0, 0.38.0 Dec 18, 2016
@nirbheek nirbheek modified the milestones: 0.38.0, 0.39.0 Feb 1, 2017
@nirbheek nirbheek modified the milestones: 0.39.0, 0.40.0 Mar 9, 2017
@nirbheek
Copy link
Member

nirbheek commented Mar 9, 2017

I don't think we need to use the same mechanism as sizeof(). For defines we can write the preprocessed output to a file and search for the value in the output.

@haaspors
Copy link
Contributor

haaspors commented Mar 9, 2017

Maybe it would be nice to have both compute_int() and define_value()/macro_value() ? As AC_COMPUTE_INT() isn't restricted to defines.

jpakkane added a commit that referenced this issue Mar 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants