Reputation: 1375
Is there a way to determine the minimum and maximum value I can pass to a compiler option. E.g.:
-fconstexpr-depth=n
or
-falign-jumps[=n]
What are the min and max values for n? Or even better would be to know what the whole value range is with all intermediate values.
I do know that this can and will depend on the code I want to compile. But I guess for a few compiler options the maximum and minimum input values can be determined independent of the code to compile.
Upvotes: 0
Views: 124
Reputation: 7009
Lets assume you are asking about GCC (it follows from tags).
fconstexpr-depth option defined in gcc/c-family/c.opt this way:
fconstexpr-depth=
C++ ObjC++ Joined RejectNegative UInteger Var(max_constexpr_depth) Init(512)
-fconstexpr-depth=<number> Specify maximum constexpr recursion depth.
What you can see immediately: GCC option description has no explicit value limits. Just default value (512) and max_constexpr_depth
variable to which this option value tied up. Lets look it up in source code...
static bool
push_cx_call_context (tree call)
{
..... some code .....
if (call_stack.length () > (unsigned) max_constexpr_depth)
return false;
return true;
}
As you see, this variable is being used without any limits checking. So correct answer: there are NO LIMITS at all. You may pass 5000 or 5000000 nobody cares, everybody assumes that you know what you are doing.
And of course, having no limits, compiler have no way to report you them.
Upvotes: 1