What some random script tries or doesn't try to do is irrelevant. tcc should follow the spec and common practices.
Generally speaking, applications which respect the POSIX syntax guidelines should treat non-option-argument "--" as an indication that all further arguments are operands: - https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html It's important to note that according to these guidelines, the options always come before the operands. I.e. mixing of options and operands (like GNU getopt does with permutations) is not allowed. Therefore, the use of "--" is to indicate where the options end and the operands start, especially for the case where the first operand begins with "-". "grep" should indeed respect these guidelines, and "--": - https://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html However, there are exceptions, for instance "echo" should not respect these guidelines and instead treat all arguments as operands: - https://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html (the fact that some implementations of "echo" deviate from the spec and allow options such as "-e" or "-n" is the reason for echo being considered non portable, and why "printf" is recommended instead) The "c99" utility, which should probably be considered the spec for tcc, has some exceptions with regards to the syntax guidelines: - https://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html While it does not specifically mention "--", it does say that options and operands can be mixed, and some options should appear after [c-files] operands, such as the "-l" and "-L" options (check the synopsis). For that reason, allowing "--" to be used before c-filenames is a footgun, because then it's not possible to add "-l" or "-L" options as needed by the spec. The fact that gcc also doesn't recognize "--" is existing common practice as well. However, clang does recognize "--", and indeed, it rejects "-l" or "-L" if they appear after "--" and some c-filenames. As far as I can tell that's inconsistent with the "c99" POSIX spec. So there you go. The main point of this is that it's not obvious that tcc should respect "--" the same as some other utilities. - avih On Sunday, April 16, 2023, 11:44:24 PM GMT+3, certanan via Tinycc-devel <[email protected]> wrote: I understand. But then what role does the flag fulfil in this script? https://github.com/qemacs/qemacs/blob/master/qe.tcc - certanan > I tried: gcc -- a.c > and got: > gcc: error: unrecognized command-line option '--' > > This is with prerelease of gcc 13. > So gcc does not support this. Why would this be needed for tcc? > > Herman > > _______________________________________________ > Tinycc-devel mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/tinycc-devel _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
_______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
