[cmake-developers] [PATCH] remove "x" placeholder from STREQUAL operands
Matthew Woehlke
mw_triad at users.sourceforge.net
Fri Apr 18 10:06:36 EDT 2014
On 2014-04-17 22:23, Ben Boeckel wrote:
> On Thu, Apr 17, 2014 at 17:17:21 -0400, Matthew Woehlke wrote:
>> Alas, the only character that may not appear in a variable name is
>> '\0'. (And even that is more due to use of raw char* with no length
>> than intent, I bet.)
>
> Actually, it's all std::string now, so you *could* use std::string(nuls,
> len) to make one. But that means modifying the CMake code and shouldn't
> be possible through CMakeLists.txt.
Probably that depends on whether a \0 escape is recognized? :-) Not that
I'm suggesting to add one, mind...
>> I keep hoping that one of these days CMake would define valid
>> identifiers as '[[:letter:]_][[:alnum:]_-]*'...
>
> Make a policy for it. Watch the world burn :) .> I also don't know where
> you'd stick the validator without a decent performance hit (the regex
> engine is not the best) :(.
Where a variable is created (e.g. the SET command), presumably. I don't
think the performance hit should be so bad if only writes are checked,
should it?
Also, a hand-written check, e.g. using isalpha(), etc. could probably be
used rather than a regex.
> May as well stick the restriction on function and macro names as
> well.
Sure, we could. Though it's probably less important for functions as we
don't have implicit dereferencing thereof as a driving case.
--
Matthew
More information about the cmake-developers
mailing list