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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-09-13
            Summary|Failed to use __asm under   |Unhelpful diagnostic for
                   |macOS 10.13                 |incorrectly ordered
                   |                            |attribute and asm on
                   |                            |function declaration in
                   |                            |system header
     Ever confirmed|0                           |1

--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
OK, so it looks like what's going on here is that the attribute and the asm are
in the wrong order. Using just 1 of them compiles successfully, as does using
them in the other order:

$ cat 82200.c
void failsyslog(int, const char *, ...) __attribute__((__format__ (__printf__,
2, 3))) __asm("_" "msyslog" "$DARWIN_EXTSN");
void okfmtsyslog(int, const char *, ...) __attribute__((__format__ (__printf__,
2, 3)));
void okasmsyslog(int, const char *, ...) __asm("_" "msyslog" "$DARWIN_EXTSN");
void okbothsyslog(int, const char *, ...) __asm("_" "msyslog" "$DARWIN_EXTSN")
__attribute__((__format__ (__printf__, 2, 3)));
int main() {}
$ /usr/local/bin/gcc -c -Wall -Wextra -pedantic 82200.c
82200.c:1:88: error: expected ‘,’ or ‘;’ before ‘__asm’
 void failsyslog(int, const char *, ...) __attribute__((__format__ (__printf__,
2, 3))) __asm("_" "msyslog" "$DARWIN_EXTSN");
                                                                               
        ^~~~~
$

So confirmed that the diagnostic could be more helpful and say something about
the attribute. I guess also the header could be fixincluded or something.

Reply via email to