From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D3ACB3858D35; Wed, 4 Jan 2023 11:40:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D3ACB3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672832428; bh=TrWxKbjRWbkoc1JsW5pzUm4zNEt3gOMt9Al778wGEo8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Kjes55fBwpJMjxpk2Gp5JGkOLg2HS0YozXr8gORVCJz0b+uPSy1JhDSGIHh9xbkR5 yrVtSjYsmEvS65hwE5Y1+ode8IuU5sVGbC5FgBvPNywoWjgIFCrzm2RDYhHX+lBXQM 7mo54auVFz1b2odEInCYyfwivAI4g2HiSDSmfn+w= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60512] would be useful if gcc implemented __has_feature similary to clang Date: Wed, 04 Jan 2023 11:40:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: WORKSFORME X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D60512 --- Comment #10 from Jonathan Wakely --- But why is that better than GCC's alternative, just defining macros like __SANITIZE_ADDRESS__ and __SANITIZE_THREAD__? Libstdc++ does this: // Macro indicating that TSAN is in use. #if __SANITIZE_THREAD__ # define _GLIBCXX_TSAN 1 #elif defined __has_feature # if __has_feature(thread_sanitizer) # define _GLIBCXX_TSAN 1 # endif #endif ISTM that it would be simpler if clang defined those macros too, because checking for both __has_feature and then using __has_feature takes more work than just checking a macro. There's currently no macro for UBsan AFAIK, but one could be added.=