From owner-svn-src-head@freebsd.org Tue May 12 18:39:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBD422F76CD; Tue, 12 May 2020 18:39:30 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi1-f174.google.com (mail-oi1-f174.google.com [209.85.167.174]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49M66B5LjSz4dBx; Tue, 12 May 2020 18:39:30 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi1-f174.google.com with SMTP id c12so18136362oic.1; Tue, 12 May 2020 11:39:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=voC8zsRwwPTD/XFCEk2l/IZWi9YPkIXrh1QpTg+AqN0=; b=RSv/0PwHZ8fdxLAbeEEdcBAncrTpO5c0YoWSm90Jj7By1rG00xTRkvkBHbv0B2dc1t LsNKYfiVv/IrTAhG0mHhheFoCYYhlSLpuybiYRciTgEOGrpncpf1FBaLaytbkW1UKyH7 kMPr+HV3093PYKFEHIG0pUaE3/AcojhLXSDoyNucj8RgCKVwDceN9HobKgI5WzLxF2xf mpjnpHxtm5CthyhK6HXO7q1V8lr9llIOudMCyUYTyWbDcxOx656iF92MlU47FcztnQg3 42EsalXTk9iGkkDEblDhVEXGKU1oj5YKauWeNu+O7r4aWIN5FJY1jIJYFkQ9bblHIZzx VBKg== X-Gm-Message-State: AGi0PuaNYQIBxj43rPKaMBuy7L68SoqVN1NDBKO8X5n3s8Ht5wbEQAKt 9tX4kA0lcCIcyYzCPc72wUEGpKKn X-Google-Smtp-Source: APiQypIwPmW5K4bs0eU12+gj4vJglY2Z8q6JuFAGJ3Jdrmr8MkJZ2jIYSO9ehvTNbG14YIlnLnTIHg== X-Received: by 2002:aca:b5d5:: with SMTP id e204mr24819250oif.108.1589308768896; Tue, 12 May 2020 11:39:28 -0700 (PDT) Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com. [209.85.167.182]) by smtp.gmail.com with ESMTPSA id g94sm3626183otg.74.2020.05.12.11.39.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 May 2020 11:39:28 -0700 (PDT) Received: by mail-oi1-f182.google.com with SMTP id i13so19132184oie.9; Tue, 12 May 2020 11:39:28 -0700 (PDT) X-Received: by 2002:aca:4ac3:: with SMTP id x186mr15767812oia.81.1589308768349; Tue, 12 May 2020 11:39:28 -0700 (PDT) MIME-Version: 1.0 References: <202005121812.04CICKdo013440@repo.freebsd.org> In-Reply-To: <202005121812.04CICKdo013440@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Tue, 12 May 2020 11:39:17 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r360983 - head/include To: Konstantin Belousov Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 49M66B5LjSz4dBx X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2020 18:39:31 -0000 Why not just use _Bool and leave the compatibility definition only for C++ (#define _Bool bool)? On Tue, May 12, 2020 at 11:12 AM Konstantin Belousov wrote: > > Author: kib > Date: Tue May 12 18:12:20 2020 > New Revision: 360983 > URL: https://svnweb.freebsd.org/changeset/base/360983 > > Log: > Clear namespace pollution in include/malloc_np.h > > Do not include stdbool.h, it makes the header incompatible with some > third-party code that typedefs bool manually. > Remove inclusion of strings.h, which typically conflicts with the use > of symbol 'index'. > Separate inclusion of sys/cdefs.h is not needed because sys/types.h > already handles that. > > Exp-run by: antoine (PR 245366) > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D24297 > > Modified: > head/include/malloc_np.h > > Modified: head/include/malloc_np.h > ============================================================================== > --- head/include/malloc_np.h Tue May 12 17:18:44 2020 (r360982) > +++ head/include/malloc_np.h Tue May 12 18:12:20 2020 (r360983) > @@ -33,29 +33,33 @@ > > #ifndef _MALLOC_NP_H_ > #define _MALLOC_NP_H_ > -#include > + > #include > -#include > -#include > > +#ifdef __cplusplus > +#define __MyBool bool > +#else > +#define __MyBool _Bool > +#endif > + > __BEGIN_DECLS > typedef struct extent_hooks_s extent_hooks_t; > -typedef void *(extent_alloc_t)(extent_hooks_t *, void *, size_t, size_t, bool *, > - bool *, unsigned); > -typedef bool (extent_dalloc_t)(extent_hooks_t *, void *, size_t, bool, > +typedef void *(extent_alloc_t)(extent_hooks_t *, void *, size_t, size_t, > + __MyBool *, __MyBool *, unsigned); > +typedef __MyBool (extent_dalloc_t)(extent_hooks_t *, void *, size_t, __MyBool, > unsigned); > -typedef void (extent_destroy_t)(extent_hooks_t *, void *, size_t, bool, > +typedef void (extent_destroy_t)(extent_hooks_t *, void *, size_t, __MyBool, > unsigned); > -typedef bool (extent_commit_t)(extent_hooks_t *, void *, size_t, size_t, size_t, > - unsigned); > -typedef bool (extent_decommit_t)(extent_hooks_t *, void *, size_t, size_t, > +typedef __MyBool (extent_commit_t)(extent_hooks_t *, void *, size_t, size_t, > size_t, unsigned); > -typedef bool (extent_purge_t)(extent_hooks_t *, void *, size_t, size_t, size_t, > +typedef __MyBool (extent_decommit_t)(extent_hooks_t *, void *, size_t, size_t, > + size_t, unsigned); > +typedef __MyBool (extent_purge_t)(extent_hooks_t *, void *, size_t, size_t, size_t, > unsigned); > -typedef bool (extent_split_t)(extent_hooks_t *, void *, size_t, size_t, size_t, > - bool, unsigned); > -typedef bool (extent_merge_t)(extent_hooks_t *, void *, size_t, void *, size_t, > - bool, unsigned); > +typedef __MyBool (extent_split_t)(extent_hooks_t *, void *, size_t, size_t, size_t, > + __MyBool, unsigned); > +typedef __MyBool (extent_merge_t)(extent_hooks_t *, void *, size_t, void *, size_t, > + __MyBool, unsigned); > struct extent_hooks_s { > extent_alloc_t *alloc; > extent_dalloc_t *dalloc; > @@ -119,5 +123,7 @@ void __dallocx(void *ptr, int flags); > void __sdallocx(void *ptr, size_t size, int flags); > size_t __nallocx(size_t size, int flags); > __END_DECLS > + > +#undef __MyBool > > #endif /* _MALLOC_NP_H_ */