When a value could either be defined or not, we used to call either `set(varname, 1)` or `set(varname, false)` respectively. This however leads to the value type of `varname` to be conditional, making it virtually unusable for testing its value. Instead, just do not emit anything when we used to emit `false`.
The only difference is that it will not generate any entry for the disabled values, but that is what Autotools do already anyway -- although Autotools emit a comment.
This fixes build if either `HAVE_FNMATCH` or `HAVE_REGCOMP` is `false` (that is, if either `fmatch()` or `regcomp()` functions are not found on the system).
Fixes #3618. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3642
-- Commit Summary --
* meson: Use only a single type for a given configuration data item
-- File Changes --
M meson.build (14)
-- Patch Links --
https://github.com/geany/geany/pull/3642.patch https://github.com/geany/geany/pull/3642.diff
Arrgggghhhhhh, C programmers!!!!! Using `1` for `true`, its boolean dammit, not a count!!!! Use `true` !!!! [end rant]
Anyway LOBI. (O==Ok, not Good, see above :-)
Yeah well, meson has its own complicated handling depending on whether the value is a boolean or not…we probably could just use a boolean as IIRC it would just make for a define without a value, but that'd be different from what we have currently, so theoretically it could impact the C code using it. So I'd rather not do it just now.
So I'd rather not do it just now.
We just done a major release, its the perfect time to do it.
Yeah, but it means not only the set of defines is different between meson and autotools, but also their value. We could be careful (and we probably are), but that sound like a great receipt for weird differences
Ok, I made a script to grep all the `#define` and `#undef` symbols in `config.h` and Geany appears to be fairly careful using `ifdef` `ifndef` or `defined()`, Scintilla has at least one place where it compares a symbol to 0, but I think its its own internal one so fine.
But ctags!!!! `if HAVE_FOO && HAVE_BAR && HAVE_BLETCH` all over the place. This relies on the identifiers having been defined `1` or it would become `if && &&` after the defined but empty identifiers were substituted. Sigh!!!
So I guess we have no choice but to continue defining `1` until C23 when `true` will be accepted :-)
Ok, I made a script to grep all the `#define` and `#undef` symbols in `config.h` and Geany appears to be fairly careful using `ifdef` `ifndef` or `defined()`,
Good :)
Scintilla has at least one place where it compares a symbol to 0, but I think its its own internal one so fine.
Fine as well.
But ctags!!!! `if HAVE_FOO && HAVE_BAR && HAVE_BLETCH` all over the place. This relies on the identifiers having been defined `1` or it would become `if && &&` after the defined but empty identifiers were substituted. Sigh!!!
Feel like making a PR upstream? :)
So I guess we have no choice but to continue defining `1` until C23 when `true` will be accepted :-)
Well meson would just emit an empty `#define FOO` if you use `cfg_data.set('FOO', true)` -- e.g. when using a boolean, it emits either an empty `#define` or a `#undef`. So kinda irrelevant :)
I can confirm that things build with this at least.
Merged #3642 into master.
github-comments@lists.geany.org