Type assertions without GCC builtins - Mailing list pgsql-hackers

From Thomas Munro
Subject Type assertions without GCC builtins
Date
Msg-id CA+hUKGL7trhWiJ4qxpksBztMMTWDyPnP1QN+Lq341V7QL775DA@mail.gmail.com
Whole thread Raw
List pgsql-hackers
Hi,

Our assertion quality is lower on Visual Studio.  I assumed there was
nothing stopping us from writing a pg_expr_has_type_p() macro using
pure standard C and C++ these days, and the attached patch seemed to
work on GCC, Clang and Visual Studio 2022 (via CI, no Windows here).

Unfortunately our unconstify() macro triggers internal errors on
Visual Studio 2019 with this applied:

    [23:39:47.176] ../src/common/file_utils.c(712): fatal error C1001:
Internal compiler error.
    [23:39:47.176] (compiler file 'msc1.cpp', line 1603)
    [23:39:47.176]  To work around this problem, try simplifying or
changing the program near the locations listed above.

Presumably _Generic type resolution and StaticAssertExpr()'s
definition are just too much for it.  I wonder if some other phrasing
could help.  Posting where I got to with this, in case anyone has any
ideas...

Attachment

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Performance issues with parallelism and LIMIT
Next
From: Jeff Davis
Date:
Subject: Re: Remaining dependency on setlocale()