From patchwork Tue Jun 8 12:36:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 54967 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 96558B7D59 for ; Tue, 8 Jun 2010 22:37:01 +1000 (EST) Received: (qmail 6544 invoked by alias); 8 Jun 2010 12:36:59 -0000 Received: (qmail 6527 invoked by uid 22791); 8 Jun 2010 12:36:58 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL, BAYES_40, MIME_QP_LONG_LINE, RCVD_IN_DNSWL_LOW, TW_CX X-Spam-Check-By: sourceware.org Received: from c60.cesmail.net (HELO c60.cesmail.net) (216.154.195.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Jun 2010 12:36:52 +0000 Received: from unknown (HELO epsilon2) ([192.168.1.60]) by c60.cesmail.net with ESMTP; 08 Jun 2010 08:36:50 -0400 Received: from 78.146.185.72 ([78.146.185.72]) by webmail.spamcop.net (Horde MIME library) with HTTP; Tue, 08 Jun 2010 08:36:50 -0400 Message-ID: <20100608083650.sznjdqd6k4kwgggc-nzlynne@webmail.spamcop.net> Date: Tue, 08 Jun 2010 08:36:50 -0400 From: Joern Rennecke To: gcc-patches@gcc.gnu.org Subject: RFC: Fix plugins/44459 2/2 MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This is the second part of the patch set to fix PR44459, which adds extern "C" linkage to a few very common functions that are used in the plugin tests of the gcc testsuite. If more, or less, or any of these should be included, might be subject to debate. Bootstrapped and regression tested in 160389 with --enable-build-with-cxx Together with the first part, in addition to testsuite/gcc.dg/plugin/one_time_plugin.c , this patch set allows testsuite/gcc.dg/plugin/ggcplug.c and testsuite/gcc.dg/plugin/dumb_plugin.c to be compiled with gcc into a functioning gcc plugin. 2010-06-08 Joern Rennecke PR plugins/44459: * tree.h: Encapsulate declarations for tree accessor failure functions in extern "C". * diagnostic-core.h (warning): Encapsulate declaration in extern "C". * system.h (fancy_abort): Encapsulate declaration in extern "C". Index: tree.h =================================================================== --- tree.h (revision 160389) +++ tree.h (working copy) @@ -871,6 +871,10 @@ enum tree_node_structure_enum { (*({__typeof (NODE) const __t = (NODE); \ &__t->common.type; })) +/* Make accessor macros usable in plugins compiled as C. */ +#ifdef __cplusplus +extern "C" { +#endif extern void tree_contains_struct_check_failed (const_tree, const enum tree_node_structure_enum, const char *, int, const char *) @@ -910,6 +914,9 @@ extern void omp_clause_range_check_faile const char *, enum omp_clause_code, enum omp_clause_code) ATTRIBUTE_NORETURN; +#ifdef __cplusplus +} +#endif #else /* not ENABLE_TREE_CHECKING, or not gcc */ Index: diagnostic-core.h =================================================================== --- diagnostic-core.h (revision 160389) +++ diagnostic-core.h (working copy) @@ -55,7 +55,14 @@ extern const char *trim_filename (const extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2) ATTRIBUTE_NORETURN; /* Pass one of the OPT_W* from options.h as the first parameter. */ +#ifdef __cplusplus +extern "C" { +#endif +/* C linkage so that plugins can use it more easyly. */ extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); +#ifdef __cplusplus +} +#endif extern bool warning_at (location_t, int, const char *, ...) ATTRIBUTE_GCC_DIAG(3,4); extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); Index: system.h =================================================================== --- system.h (revision 160389) +++ system.h (working copy) @@ -586,7 +586,14 @@ extern int vsnprintf(char *, size_t, con /* Redefine abort to report an internal error w/o coredump, and reporting the location of the error in the source file. */ +#ifdef __cplusplus +extern "C" { +#endif +/* C linkage so that it can be used more easily by plugins. */ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; +#ifdef __cplusplus +} +#endif #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__) /* Use gcc_assert(EXPR) to test invariants. */