Jump to page: 1 2
Thread overview
[Issue 23509] ImportC: Unable to parse GLibC assert.h's assert (and other nontrivial macros?)
Nov 26, 2022
TheGag96
Dec 17, 2022
Iain Buclaw
Jan 12, 2023
Thomas Brix Larsen
Feb 28, 2023
Dennis
Apr 09, 2023
Walter Bright
Apr 09, 2023
Walter Bright
[Issue 23509] ImportC: need statement expressions extension for GLibC's assert()
Apr 09, 2023
Walter Bright
Apr 10, 2023
Dlang Bot
Apr 10, 2023
Dlang Bot
November 26, 2022
https://issues.dlang.org/show_bug.cgi?id=23509

TheGag96 <kipthemudkip@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ImportC

--- Comment #1 from TheGag96 <kipthemudkip@yahoo.com> ---
Link to Mosquitto library: https://github.com/eclipse/mosquitto

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23509

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
January 12, 2023
https://issues.dlang.org/show_bug.cgi?id=23509

Krzysztof Jajeśnica <krzysztof.jajesnica@student.put.poznan.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |krzysztof.jajesnica@student
                   |                            |.put.poznan.pl

--- Comment #2 from Krzysztof Jajeśnica <krzysztof.jajesnica@student.put.poznan.pl> ---
I accidentally hit the same bug while trying to compile the Nuklear library with DMD 2.101.1 on Manjaro Linux.

Based on the error message and source code of assert.h I think ImportC is trying to use the following definition of assert:

#  define assert(expr)                                                  \
  ((void) sizeof ((expr) ? 1 : 0), __extension__ ({                     \
      if (expr)                                                         \
        ; /* empty */                                                   \
      else                                                              \
        __assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION);   \
    }))

The problem seems to be caused by 2 GCC extensions used in the assert macro which are not supported by ImportC:

1. Statement expressions
(https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html)
   (basically GCC treats code like this: ({statement1; statement2;}) as an
expression)

2. __PRETTY_FUNCTION__ - this one is hidden inside the __ASSERT_FUNCTION macro

--
January 12, 2023
https://issues.dlang.org/show_bug.cgi?id=23509

Krzysztof Jajeśnica <krzysztof.jajesnica@student.put.poznan.pl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |23619


Referenced Issues:

https://issues.dlang.org/show_bug.cgi?id=23619
[Issue 23619] ImportC: Doesn't work with flecs.h
--
January 12, 2023
https://issues.dlang.org/show_bug.cgi?id=23509

Thomas Brix Larsen <brix@brix-verden.dk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brix@brix-verden.dk

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

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel@live.nl

--- Comment #3 from Dennis <dkorpel@live.nl> ---
I also stumbled on this when trying to compile the tree-sitter run time library.

--
April 09, 2023
https://issues.dlang.org/show_bug.cgi?id=23509

Walter Bright <bugzilla@digitalmars.com> changed:

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

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
Might be able to support statement expressions by converting them to a nested function with no arguments.

This won't work, though, with jumping into or out of a statement expression.

--
April 09, 2023
https://issues.dlang.org/show_bug.cgi?id=23509

--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> ---
*** Issue 23619 has been marked as a duplicate of this issue. ***

--
April 09, 2023
https://issues.dlang.org/show_bug.cgi?id=23509

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ImportC: Unable to parse    |ImportC: need statement
                   |GLibC assert.h's assert     |expressions extension for
                   |(and other nontrivial       |GLibC's assert()
                   |macros?)                    |

--
April 10, 2023
https://issues.dlang.org/show_bug.cgi?id=23509

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
@WalterBright created dlang/dmd pull request #15093 "fix Issue 23509 - ImportC: need statement expressions extension" fixing this issue:

- fix Issue 23509 - ImportC: need statement expressions extension for GLibC's
assert()

https://github.com/dlang/dmd/pull/15093

--
« First   ‹ Prev
1 2