https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113378

--- Comment #4 from Alejandro Colomar <alx at kernel dot org> ---
On Mon, Jan 15, 2024 at 08:35:53AM +0000, rguenth at gcc dot gnu.org wrote:
> --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
> We could buffer stdin to a temporary file ... (of course that would defeat 
> it's
> purpose somewhat).

Not necessarily.  I use stdin for simplicity in small tests.  The
test suite runs some sh(1) scripts, which themselves do more or less:


        #!/usr/bin/bash
        set -Eeuf;
        out="$(mktemp)";
        CFLAGS=...
        LIBS=...

        cc $CFLAGS -o "$out" -x c - $LIBS 2>&1 <<__EOF__ \
        | if ! grep -- '-Werror=pointer-sign' >/dev/null; then \
                >&2 printf '%s\n' "$0:$LINENO: Expected error:
[-Werror=pointer-sign]"; \
                exit 1; \
        else \
                true; \
        fi;
                #include <a2i/str2i.h>

                int
                main(void)
                {
                        unsigned char  n;

                        str2i(signed char, &n, "0");
                }
        __EOF__

And a script can have several of those embedded C programs, without
really having so many .c files.

If the compiler chooses to use a temporary file to improve the
diagnostics, that's not a problem.

Reply via email to