Thread overview
[Issue 23702] compilable/test23616.c:3:20: error: missing binary operator before token "("
Feb 12, 2023
Iain Buclaw
Feb 16, 2023
Walter Bright
Feb 16, 2023
Iain Buclaw
Feb 20, 2023
Walter Bright
Feb 20, 2023
Iain Buclaw
Feb 27, 2023
Iain Buclaw
Dec 02, 2023
Walter Bright
Dec 14, 2023
Walter Bright
February 12, 2023
https://issues.dlang.org/show_bug.cgi?id=23702

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, ImportC
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=23689
         Depends on|                            |23689


Referenced Issues:

https://issues.dlang.org/show_bug.cgi?id=23689
[Issue 23689] ImportC: C tests in the testsuite are not valid C
--
February 16, 2023
https://issues.dlang.org/show_bug.cgi?id=23702

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
Shouldn't the C preprocessor remove the #if line? and the #endif line?

--
February 16, 2023
https://issues.dlang.org/show_bug.cgi?id=23702

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org

--- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to Walter Bright from comment #1)
> Shouldn't the C preprocessor remove the #if line? and the #endif line?
It's the C preprocessor that's rejecting it. I don't know why dmd compiles this, but gcc doesn't.

If you know, then it should be documented on the importc page here https://dlang.org/spec/importc.html#extensions

Though I suspect maybe under predefined macros would be more appropriate.

--
February 20, 2023
https://issues.dlang.org/show_bug.cgi?id=23702

--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> ---
__has_extension is yet another C compiler extension (not ImportC's invention).

--
February 20, 2023
https://issues.dlang.org/show_bug.cgi?id=23702

--- Comment #4 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to Walter Bright from comment #3)
> __has_extension is yet another C compiler extension (not ImportC's
> invention).
It's not GCC's invention either.  Whose it is? It should be documented on the ImportC page.

--
February 27, 2023
https://issues.dlang.org/show_bug.cgi?id=23702

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--
December 02, 2023
https://issues.dlang.org/show_bug.cgi?id=23702

--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> ---
importc.h has the following lines in it:

    #undef __has_extension
    #define __has_extension(x) 0

so:

    #if __has_extension(gnu_asm)

should become:

    #if 0

I don't know what is going wrong here. Maybe __has_extension cannot be undefined?

--
December 14, 2023
https://issues.dlang.org/show_bug.cgi?id=23702

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> ---
__has_extension is a clang invention:

https://clang.llvm.org/docs/LanguageExtensions.html#feature-checking-macros

It is not supported or recognized by ImportC, it is just #undef'd away in importc.h.

You can file a general issue that importc.h should be documented in the ImportC specification, but the contents of the file itself serves as its documentation.

Until then, I'll file this as WONTFIX.

--
December 15, 2023
https://issues.dlang.org/show_bug.cgi?id=23702
Issue 23702 depends on issue 23689, which changed state.

Issue 23689 Summary: ImportC: C tests in the testsuite are not valid C https://issues.dlang.org/show_bug.cgi?id=23689

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--