On Mon, 20 Apr 2020, Helmut Grohne wrote:
Now you are probably going to say that "-isystem /usr/include" is a bad idea and that you shouldn't do that. I'm inclined to agree. This isn't a problem just yet. Debian wants to move /usr/include/stdlib.h to /usr/include/<multiarch>/stdlib.h. After that move, the problematic flag becomes "-isystem /usr/include/<multiarch>". Unfortunately, around 30 Debian packages[1] do pass exactly that flag. Regardless whether doing so is a bad idea, I guess we will have to support that.
Urgh, no to "support that". I don't like those #include_next of a header with a different name and wouldn't mind seeing them go. But even if your patch, or some other patch, happens to make things kind of work, please do **not** consider this a supported feature, and keep fixing those broken packages (including the big bad cmake which regularly adds such flags to innocent packages).
With (or without) your patch, if a user has the bad -isystem and does #include <stdlib.h>, it will never see libstdc++'s version of stdlib.h, which contains important extra content, so that's still not working properly.
-- Marc Glisse