It would be great if is-flagq or is-flag would only respect the last occurrence of each parameter. For example: CFLAGS="-g2 -O3 -g0 -O0" is-flag should then not return true for "-O3", as it has been overwritten by "-O0". Similar for "-g In my scenario, I do all packages by default via "-ggdb -O2 -pipe -march=something" and I disable debugging for specific packages (e.g. chromium) by using /etc/portage/env/disable_debug with CFLAGS="${CFLAGS} -ggdb0 -g0" Unfortunately a lot of packages use is-flag(q) and hence complain about debugging cflags (like chromium's excessive disk requirements) which actually are not used here.
We will unlikely implement complete parser for CFLAGS in any reasonable match to what gcc does.