Re: partitioned tables and contrib/sepgsql

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,Joe Conway <mail(at)joeconway(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>,Mike Palmiotto <mike(dot)palmiotto(at)crunchydata(dot)com>,Stephen Frost <sfrost(at)snowman(dot)net>,"pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: partitioned tables and contrib/sepgsql
Date: 2017-04-05 16:06:52
Message-ID: D332AB34-C1A0-4F96-855C-07A55128CA3F@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On April 5, 2017 9:04:00 AM PDT, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>Joe Conway <mail(at)joeconway(dot)com> writes:
>> On 04/04/2017 09:58 PM, Tom Lane wrote:
>>> Another issue is whether you won't get compiler complaints about
>>> redefinition of the "true" and "false" macros. But those would
>>> likely only be warnings, not flat-out errors.
>
>> I have not been able to generate warnings or errors around "true" and
>> "false".
>
>Interesting. Poking at it on a Fedora 25 machine, I also see a
>bool-type-related warning in sepgsql/label.c, but nothing around macro
>redefinitions. In particular, I find that
>
>#include "postgres.h"
>
>#include <stdbool.h>
>
>is completely silent. On the other hand,
>
>#include "postgres.h"
>
>#define bool _Bool
>#define true 1
>#define false 0
>
>generates the warnings I expected about "true" and "false" being
>redefined. Which is damn odd, because I copied-and-pasted those
>lines out of
>/usr/lib/gcc/x86_64-redhat-linux/6.3.1/include/stdbool.h
>
>Conclusion: Fedora's gcc is playing fast and loose somehow with the
>command "#include <stdbool.h>"; that does not include the file
>you'd think it does, it does something magic inside the compiler.
>The magic evidently includes not complaining about duplicate macro
>definitions for true and false.
>
>Anyway, I'd recommend that we do something like
>
> #include <selinux/label.h>
>+
>+/*
>+ * <selinux/label.h> includes <stdbool.h>, which creates an
>incompatible
>+ * #define for bool. Get rid of that so we can use our own typedef.
>+ * (For obscure reasons, the "true" and "false" macros don't cause
>issues.)
>+ */

GCC generally doesn't warn about macro redefinitions, if both definitions are equivalent. IIRC we have some examples of that in the tree. There's a flag to warn regardless.

Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-04-05 16:14:05 Re: partitioned tables and contrib/sepgsql
Previous Message Robert Haas 2017-04-05 16:06:43 Re: PG_GETARG_GISTENTRY?