Hi On Fri, Aug 15, 2014 at 11:38 AM, Lennart Poettering <lenn...@poettering.net> wrote: > On Fri, 15.08.14 10:55, David Herrmann (dh.herrm...@gmail.com) wrote: > >> Hm, I don't know whether that works. See the description here: >> https://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Other-Builtins.html >> >> What you propose is something like my attached patch, I guess? Along >> the lines of: >> (__builtin_constant_p(A) && __builtin_constant_p(B)) ? >> ((A) > (B) ? (A) : (B)) : >> ({ ....OLD_MAX.... }) > > Yes, correct. > >> Thing is, the ELSE case is not considered a compile-time constant by >> LLVM. > > In that case __builtin_constant_p() would be entirely useless on LLVM, > right? And all uses by this construct in glibc would not work, right?
No, it's just useless for our case. glibc uses __builtin_constant_p() heavily to validate parameters. For instance, it's very handy to verify length restrictions and so on. And I think it was introduced mainly to allow optimizations, not to allow conditional compilations. But maybe __builtin_choose_expr() works like that. Example: strlen() can use __builtin_constant_p() to use sizeof() - 1 on constant expressions (ok, it cannot, because there might be a NUL in the middle, but I guess you get the idea?). Thanks David _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel