From patchwork Mon Jun 25 16:48:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 934478 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-480445-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gM/UUoNu"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41DwBf2yK2z9ry1 for ; Tue, 26 Jun 2018 02:49:44 +1000 (AEST) Received: (qmail 55764 invoked by alias); 25 Jun 2018 16:49:33 -0000 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 Received: (qmail 55360 invoked by uid 89); 25 Jun 2018 16:49:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=APP, fake, png, didn X-HELO: mail-yb0-f169.google.com Received: from mail-yb0-f169.google.com (HELO mail-yb0-f169.google.com) (209.85.213.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 25 Jun 2018 16:49:04 +0000 Received: by mail-yb0-f169.google.com with SMTP id a2-v6so4834953ybe.11 for ; Mon, 25 Jun 2018 09:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=sG9eNSZjz4xTjU7jydsdhKRre1UBqRlsjcF9fKV0Z2s=; b=gM/UUoNuYOgPkmcROWosjiZyo7tDspuPtL01ze7WLiEnMSFBS4QdNPBVLKIN4EQqDY 1yHtVFCV8xuQY32xQZMuV+L0VuLi/NeogJWJl9s2CCNnP4drk8Ls/Z0HayasU0E6WcV4 S/3cMmKaVUS6vCwuCD8LMJ2bP0A/XveDknjQBFrQCElF9bY+tRUytZ44fKQ66rzUwE1G vvA0zdoOvJo6ORCcsRgFlRM/SOFdtH0vx3n1qlEzeQv2U4w+75j4dEZ19K/DrBvJ+FE2 jK3osbJmBjgDjADVTLnje9BEQo/amnw6Q13IMAxfxSd1x4Uk0Zi862tZE+RAriJgbBgs R1Vg== Received: from ?IPv6:2620:10d:c0a3:20fb:7500:e7fb:4a6f:2254? ([2620:10d:c091:200::3:1c8e]) by smtp.googlemail.com with ESMTPSA id k64-v6sm1709852ywb.7.2018.06.25.09.48.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 09:48:54 -0700 (PDT) Sender: Nathan Sidwell To: GCC Patches , David Edelsohn From: Nathan Sidwell Subject: Invert sense of NO_IMPLICIT_EXTERN_C Message-ID: <66067c72-c34d-2691-ae03-909a942d446c@acm.org> Date: Mon, 25 Jun 2018 12:48:53 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 NO_IMPLICIT_EXTERN_C was introduced to tell the compiler that it didn't need to fake up 'extern "C" { ... }' around system header files. Over the years more and more system headers have become C++-aware, leading to more targets defining this macro. Unfortunately because of the sense of this macro, and that the requirement is based on the target-OS, whereas we partition the config directory by target-ARCH, it's become hard to know which targets still require the older functionality. There have been a few questions over the past 2 decades to figure this out, but they didn;t progress. This patch replaces the negative NO_IMPLICIT_EXTERN_C with the positive SYSTEM_IMPLICIT_EXTERN_C. Targets that previously did not define NO_IMPLICIT_EXTERN_C now need to define SYSTEM_IMPLICIT_EXTERN_C. I know of one such target -- AIX, and I'd be grateful this patch could be tried there. Going through the config files was tricky, and I may well have missed something. One suspicious file is config/sparc/openbsd64.h which did explicitly undef the macro, with the comment: /* Inherited from sp64-elf. */ sp64-elf.h does define the macro, but the other bsd's also define it, which leaves me wondering if openbsd.h has bit rotted here. Which leads me to another observation: It's quite possible the extern "C" functionality is enabled on targets that no longer need it, because their observed behaviour would not be broken. On the other hand, the failure mode of not defining its replacement (or alternatively mistakenly defining NO_IMPLICIT_EXTERN_C), would be immediate and obvious. And the fix is also simple. So, if you have a target that you think has C++-unaware system headers, please give this patch a spin and report. Blessing from a GM after a few days out there would be nice :) The lesson here is that when one has a transition, chose an enablement mechanism that makes it easy to tell when the transition is complete. nathan 2018-06-25 Nathan Sidwell gcc/c-family/ * c-lex.c (fe_file_change): Check SYSTEM_IMPLICIT_EXTERN_C not NO_IMPLICIT_EXTERN_C. gcc/cp/ * cp/decl.c (decls_match): Check SYSTEM_IMPLICIT_EXTERN_C not NO_IMPLICIT_EXTERN_C. * cp/parser.c (cp_parser_parameter_declaration_clause): Likewise. gcc/ Replace NO_IMPLICIT_EXTERN_C with SYSTEM_IMPLICIT_EXTERN_C. * doc/cpp.texi: Update comment. * doc/tm.texi: Rebuilt. * doc/tm.texi.in (NO_IMPLICIT_EXTERN_C): Replace with ... (SYSTEM_IMPLICIT_EXTERN_C): ... this, opposite sense. * doc/extend.texi (Backwards Compatibility): Clarify it is system headers affected by extern "C". * system.h: Poison NO_IMPLICIT_EXTERN_C. * config/alpha/alpha.h, config/arm/uclinux-elf.h, config/bfin/elf.h, config/cris/cris.h, config/darwin.h, config/dragonfly.h, config/freebsd.h, config/gnu-user.h, config/i386/cygming.h, config/i386/djgpp.h, config/i386/nto.h, config/ia64/hpux.h, config/lm32/lm32.h, config/lm32/uclinux-elf.h, config/lynx.h, config/mips/elf.h, config/mmix/mmix.h, config/netbsd.h, config/pa/pa-hpux.h, config/powerpcspe/sysv4.h, config/riscv/elf.h, config/rs6000/sysv4.h, config/rtems.h, config/s390/tpf.h, config/sh/newlib.h, config/sol2.h, config/sparc/openbsd64.h, config/sparc/sp-elf.h, config/sparc/sp64-elf.h, config/spu/spu.h, config/stormy16/stormy16.h, config/v850/v850.h, config/visium/visium.h, config/vx-common.h, config/xtensa/elf.h: Don't define NO_IMPLICIT_EXTERN_C. * config/rs6000/aix.h: Set SYSTEM_IMPLICIT_EXTERN_C. Index: c-family/c-lex.c =================================================================== --- c-family/c-lex.c (revision 262020) +++ c-family/c-lex.c (working copy) @@ -206,7 +206,7 @@ fe_file_change (const line_map_ordinary input_location = new_map->start_location; (*debug_hooks->start_source_file) (line, LINEMAP_FILE (new_map)); -#ifndef NO_IMPLICIT_EXTERN_C +#ifdef SYSTEM_IMPLICIT_EXTERN_C if (c_header_level) ++c_header_level; else if (LINEMAP_SYSP (new_map) == 2) @@ -219,7 +219,7 @@ fe_file_change (const line_map_ordinary } else if (new_map->reason == LC_LEAVE) { -#ifndef NO_IMPLICIT_EXTERN_C +#ifdef SYSTEM_IMPLICIT_EXTERN_C if (c_header_level && --c_header_level == 0) { if (LINEMAP_SYSP (new_map) == 2) Index: config/alpha/alpha.h =================================================================== --- config/alpha/alpha.h (revision 262020) +++ config/alpha/alpha.h (working copy) @@ -922,7 +922,4 @@ extern long alpha_auto_offset; /* By default, turn on GDB extensions. */ #define DEFAULT_GDB_EXTENSIONS 1 -/* The system headers under Alpha systems are generally C++-aware. */ -#define NO_IMPLICIT_EXTERN_C - #define TARGET_SUPPORTS_WIDE_INT 1 Index: config/arm/uclinux-elf.h =================================================================== --- config/arm/uclinux-elf.h (revision 262020) +++ config/arm/uclinux-elf.h (working copy) @@ -48,9 +48,6 @@ } \ while (false) -/* Do not assume anything about header files. */ -#define NO_IMPLICIT_EXTERN_C - /* The GNU C++ standard library requires that these macros be defined. */ #undef CPLUSPLUS_CPP_SPEC #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" Index: config/bfin/elf.h =================================================================== --- config/bfin/elf.h (revision 262020) +++ config/bfin/elf.h (working copy) @@ -70,5 +70,3 @@ asm (TEXT_SECTION_ASM_OP); #undef SUBTARGET_DRIVER_SELF_SPECS #define SUBTARGET_DRIVER_SELF_SPECS \ "%{mfdpic:-msim} %{mid-shared-library:-msim}" - -#define NO_IMPLICIT_EXTERN_C Index: config/cris/cris.h =================================================================== --- config/cris/cris.h (revision 262020) +++ config/cris/cris.h (working copy) @@ -1030,8 +1030,6 @@ enum cris_symbol_type #define FUNCTION_MODE QImode -#define NO_IMPLICIT_EXTERN_C - /* * Local variables: * eval: (c-set-style "gnu") Index: config/darwin.h =================================================================== --- config/darwin.h (revision 262020) +++ config/darwin.h (working copy) @@ -43,9 +43,6 @@ see the files COPYING3 and COPYING.RUNTI #define DARWIN_X86 0 #define DARWIN_PPC 0 -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - /* Suppress g++ attempt to link in the math library automatically. */ #define MATH_LIBRARY "" Index: config/dragonfly.h =================================================================== --- config/dragonfly.h (revision 262020) +++ config/dragonfly.h (working copy) @@ -104,10 +104,6 @@ see the files COPYING3 and COPYING.RUNTI #undef OBJECT_FORMAT_ELF #define OBJECT_FORMAT_ELF -/* Don't assume anything about the header files. */ -#undef NO_IMPLICIT_EXTERN_C -#define NO_IMPLICIT_EXTERN_C 1 - /* Follow DragonFly's standard headers (, etc...). */ #undef WCHAR_TYPE Index: config/freebsd.h =================================================================== --- config/freebsd.h (revision 262020) +++ config/freebsd.h (working copy) @@ -68,10 +68,6 @@ along with GCC; see the file COPYING3. #undef OBJECT_FORMAT_ELF #define OBJECT_FORMAT_ELF -/* Don't assume anything about the header files. */ -#undef NO_IMPLICIT_EXTERN_C -#define NO_IMPLICIT_EXTERN_C 1 - /* Follow FreeBSD's standard headers ( etc...). */ #undef WCHAR_TYPE Index: config/gnu-user.h =================================================================== --- config/gnu-user.h (revision 262020) +++ config/gnu-user.h (working copy) @@ -26,9 +26,6 @@ a copy of the GCC Runtime Library Except see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - #undef ASM_APP_ON #define ASM_APP_ON "#APP\n" Index: config/i386/cygming.h =================================================================== --- config/i386/cygming.h (revision 262020) +++ config/i386/cygming.h (working copy) @@ -378,9 +378,6 @@ do { \ #endif #endif -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - #undef PROFILE_HOOK #define PROFILE_HOOK(LABEL) \ if (MAIN_NAME_P (DECL_NAME (current_function_decl))) \ Index: config/i386/djgpp.h =================================================================== --- config/i386/djgpp.h (revision 262020) +++ config/i386/djgpp.h (working copy) @@ -23,9 +23,6 @@ along with GCC; see the file COPYING3. #undef PREFERRED_DEBUGGING_TYPE #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - #undef BSS_SECTION_ASM_OP #define BSS_SECTION_ASM_OP "\t.section\t.bss" Index: config/i386/nto.h =================================================================== --- config/i386/nto.h (revision 262020) +++ config/i386/nto.h (working copy) @@ -98,8 +98,6 @@ crti.o%s \ #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE BITS_PER_WORD -#define NO_IMPLICIT_EXTERN_C 1 - #define TARGET_POSIX_IO #undef DBX_REGISTER_NUMBER Index: config/ia64/hpux.h =================================================================== --- config/ia64/hpux.h (revision 262020) +++ config/ia64/hpux.h (working copy) @@ -185,9 +185,6 @@ do { \ #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode) -/* HP-UX headers are C++-compatible. */ -#define NO_IMPLICIT_EXTERN_C - /* HP-UX uses PROFILE_HOOK instead of FUNCTION_PROFILER but we need a FUNCTION_PROFILER defined because its use is not ifdefed. When using PROFILE_HOOK, the profile call comes after the prologue. */ Index: config/lm32/lm32.h =================================================================== --- config/lm32/lm32.h (revision 262020) +++ config/lm32/lm32.h (working copy) @@ -516,8 +516,4 @@ do { #define FUNCTION_MODE SImode -#ifndef NO_IMPLICIT_EXTERN_C -#define NO_IMPLICIT_EXTERN_C -#endif - #define STORE_FLAG_VALUE 1 Index: config/lm32/uclinux-elf.h =================================================================== --- config/lm32/uclinux-elf.h (revision 262020) +++ config/lm32/uclinux-elf.h (working copy) @@ -21,10 +21,6 @@ /* elfos.h should have already been included. Now just override any conflicting definitions and add any extras. */ -/* Do not assume anything about header files. */ -#undef NO_IMPLICIT_EXTERN_C -#define NO_IMPLICIT_EXTERN_C - /* The GNU C++ standard library requires that these macros be defined. */ #undef CPLUSPLUS_CPP_SPEC #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)" Index: config/lynx.h =================================================================== --- config/lynx.h (revision 262020) +++ config/lynx.h (working copy) @@ -165,12 +165,6 @@ along with GCC; see the file COPYING3. # define PREFERRED_DEBUGGING_TYPE DBX_DEBUG #endif -/* We have C++ support in our system headers. */ - -#ifndef NO_IMPLICIT_EXTERN_C -# define NO_IMPLICIT_EXTERN_C -#endif - #ifndef TARGET_POSIX_IO # define TARGET_POSIX_IO #endif Index: config/mips/elf.h =================================================================== --- config/mips/elf.h (revision 262020) +++ config/mips/elf.h (working copy) @@ -46,5 +46,3 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC "crtend%O%s crtn%O%s" - -#define NO_IMPLICIT_EXTERN_C 1 Index: config/mmix/mmix.h =================================================================== --- config/mmix/mmix.h (revision 262020) +++ config/mmix/mmix.h (working copy) @@ -789,8 +789,6 @@ typedef struct { int regs; int lib; } CU #define FUNCTION_MODE QImode -#define NO_IMPLICIT_EXTERN_C - /* mmix-knuth-mmixware target has no support of C99 runtime */ #undef TARGET_LIBC_HAS_FUNCTION #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function Index: config/netbsd.h =================================================================== --- config/netbsd.h (revision 262020) +++ config/netbsd.h (working copy) @@ -149,10 +149,6 @@ along with GCC; see the file COPYING3. #undef TARGET_POSIX_IO #define TARGET_POSIX_IO -/* Don't assume anything about the header files. */ -#undef NO_IMPLICIT_EXTERN_C -#define NO_IMPLICIT_EXTERN_C 1 - /* Define some types that are the same on all NetBSD platforms, making them agree with . */ Index: config/pa/pa-hpux.h =================================================================== --- config/pa/pa-hpux.h (revision 262020) +++ config/pa/pa-hpux.h (working copy) @@ -102,10 +102,6 @@ along with GCC; see the file COPYING3. "%{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{g*:-a archive} %{shared:-b}" #endif -/* hpux8 and later have C++ compatible include files, so do not - pretend they are `extern "C"'. */ -#define NO_IMPLICIT_EXTERN_C - /* hpux11 and earlier don't have fputc_unlocked, so we must inhibit the transformation of fputs_unlocked and fprintf_unlocked to fputc_unlocked. */ #define DONT_HAVE_FPUTC_UNLOCKED Index: config/powerpcspe/sysv4.h =================================================================== --- config/powerpcspe/sysv4.h (revision 262020) +++ config/powerpcspe/sysv4.h (working copy) @@ -23,10 +23,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -/* Header files should be C++ aware in general. */ -#undef NO_IMPLICIT_EXTERN_C -#define NO_IMPLICIT_EXTERN_C - /* Yes! We are ELF. */ #define TARGET_OBJECT_FORMAT OBJECT_ELF Index: config/riscv/elf.h =================================================================== --- config/riscv/elf.h (revision 262020) +++ config/riscv/elf.h (working copy) @@ -32,5 +32,3 @@ along with GCC; see the file COPYING3. #undef ENDFILE_SPEC #define ENDFILE_SPEC "crtend%O%s" - -#define NO_IMPLICIT_EXTERN_C 1 Index: config/rs6000/aix.h =================================================================== --- config/rs6000/aix.h (revision 262020) +++ config/rs6000/aix.h (working copy) @@ -23,6 +23,9 @@ #undef TARGET_AIX #define TARGET_AIX 1 +/* System headers are not C++-aware. */ +#define SYSTEM_IMPLICIT_EXTERN_C 1 + /* Linux64.h wants to redefine TARGET_AIX based on -m64, but it can't be used in the #if conditional in options-default.h, so provide another macro. */ #undef TARGET_AIX_OS Index: config/rs6000/sysv4.h =================================================================== --- config/rs6000/sysv4.h (revision 262020) +++ config/rs6000/sysv4.h (working copy) @@ -23,10 +23,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -/* Header files should be C++ aware in general. */ -#undef NO_IMPLICIT_EXTERN_C -#define NO_IMPLICIT_EXTERN_C - /* Yes! We are ELF. */ #define TARGET_OBJECT_FORMAT OBJECT_ELF Index: config/rtems.h =================================================================== --- config/rtems.h (revision 262020) +++ config/rtems.h (working copy) @@ -22,10 +22,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -/* The system headers under RTEMS are C++-aware. */ -#undef NO_IMPLICIT_EXTERN_C -#define NO_IMPLICIT_EXTERN_C - /* * Dummy start/end specification to let linker work as * needed by autoconf scripts using this compiler. Index: config/s390/tpf.h =================================================================== --- config/s390/tpf.h (revision 262020) +++ config/s390/tpf.h (working copy) @@ -30,7 +30,6 @@ along with GCC; see the file COPYING3. #define ASM_APP_ON "#APP\n" #undef ASM_APP_OFF #define ASM_APP_OFF "#NO_APP\n" -#define NO_IMPLICIT_EXTERN_C #define TARGET_POSIX_IO #undef SIZE_TYPE Index: config/sh/newlib.h =================================================================== --- config/sh/newlib.h (revision 262020) +++ config/sh/newlib.h (working copy) @@ -23,7 +23,3 @@ along with GCC; see the file COPYING3. #undef LIB_SPEC #define LIB_SPEC "-lc -lgloss" - -#undef NO_IMPLICIT_EXTERN_C -#define NO_IMPLICIT_EXTERN_C 1 - Index: config/sol2.h =================================================================== --- config/sol2.h (revision 262020) +++ config/sol2.h (working copy) @@ -423,9 +423,6 @@ along with GCC; see the file COPYING3. produce the same format. */ #define NM_FLAGS "-png" -/* The system headers under Solaris 2 are C++-aware since 2.0. */ -#define NO_IMPLICIT_EXTERN_C - #define STDC_0_IN_SYSTEM_HEADERS 1 /* Support Solaris-specific format checking for cmn_err. */ Index: config/sparc/openbsd64.h =================================================================== --- config/sparc/openbsd64.h (revision 262020) +++ config/sparc/openbsd64.h (working copy) @@ -41,9 +41,6 @@ along with GCC; see the file COPYING3. } \ while (0) -/* Inherited from sp64-elf. */ -#undef NO_IMPLICIT_EXTERN_C - #undef ASM_SPEC #define ASM_SPEC "\ -s %{" FPIE_OR_FPIC_SPEC ":-K PIC} \ Index: config/sparc/sp-elf.h =================================================================== --- config/sparc/sp-elf.h (revision 262020) +++ config/sparc/sp-elf.h (working copy) @@ -18,9 +18,6 @@ You should have received a copy of the G along with GCC; see the file COPYING3. If not see . */ -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - /* It's safe to pass -s always, even if -g is not used. */ #undef ASM_SPEC #define ASM_SPEC \ Index: config/sparc/sp64-elf.h =================================================================== --- config/sparc/sp64-elf.h (revision 262020) +++ config/sparc/sp64-elf.h (working copy) @@ -27,9 +27,6 @@ along with GCC; see the file COPYING3. #undef SPARC_DEFAULT_CMODEL #define SPARC_DEFAULT_CMODEL CM_EMBMEDANY -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - #undef ASM_SPEC #define ASM_SPEC "\ -s %{" FPIE_OR_FPIC_SPEC ":-K PIC} \ Index: config/spu/spu.h =================================================================== --- config/spu/spu.h (revision 262020) +++ config/spu/spu.h (working copy) @@ -483,8 +483,6 @@ do { \ #define FUNCTION_MODE QImode -#define NO_IMPLICIT_EXTERN_C 1 - /* Address spaces. */ #define ADDR_SPACE_EA 1 Index: config/stormy16/stormy16.h =================================================================== --- config/stormy16/stormy16.h (revision 262020) +++ config/stormy16/stormy16.h (working copy) @@ -476,5 +476,3 @@ enum reg_class #define Pmode HImode #define FUNCTION_MODE HImode - -#define NO_IMPLICIT_EXTERN_C Index: config/v850/v850.h =================================================================== --- config/v850/v850.h (revision 262020) +++ config/v850/v850.h (working copy) @@ -851,12 +851,6 @@ extern const char * GHS_current_section_ #define TARGET_ASM_INIT_SECTIONS v850_asm_init_sections -/* Define this so that the cc1plus will not think that system header files - need an implicit 'extern "C" { ... }' assumed. This breaks testing C++ - in a build directory where the libstdc++ header files are found via a - -isystem . */ -#define NO_IMPLICIT_EXTERN_C - #define ADJUST_INSN_LENGTH(INSN, LENGTH) \ ((LENGTH) = v850_adjust_insn_length ((INSN), (LENGTH))) Index: config/visium/visium.h =================================================================== --- config/visium/visium.h (revision 262020) +++ config/visium/visium.h (working copy) @@ -1211,14 +1211,6 @@ do \ machines this should be `QImode'. */ #define FUNCTION_MODE SImode -/* `NO_IMPLICIT_EXTERN_C' - - Define this macro if the system header files support C++ as well as - C. This macro inhibits the usual method of using system header - files in C++, which is to pretend that the file's contents are - enclosed in `extern "C" {...}'. */ -#define NO_IMPLICIT_EXTERN_C - /* Dividing the Output into Sections (Texts, Data, ...) An object file is divided into sections containing different types Index: config/vx-common.h =================================================================== --- config/vx-common.h (revision 262020) +++ config/vx-common.h (working copy) @@ -18,10 +18,6 @@ You should have received a copy of the G along with GCC; see the file COPYING3. If not see . */ -/* VxWorks headers are C++-aware. */ -#undef NO_IMPLICIT_EXTERN_C -#define NO_IMPLICIT_EXTERN_C - /* Most of these will probably be overridden by subsequent headers. We undefine them here just in case, and define VXWORKS_ versions of each, to be used in port-specific vxworks.h. */ Index: config/xtensa/elf.h =================================================================== --- config/xtensa/elf.h (revision 262020) +++ config/xtensa/elf.h (working copy) @@ -20,9 +20,6 @@ along with GCC; see the file COPYING3. #define TARGET_SECTION_TYPE_FLAGS xtensa_multibss_section_type_flags -/* Don't assume anything about the header files. */ -#define NO_IMPLICIT_EXTERN_C - #undef ASM_APP_ON #define ASM_APP_ON "#APP\n" Index: cp/decl.c =================================================================== --- cp/decl.c (revision 262020) +++ cp/decl.c (working copy) @@ -967,7 +967,7 @@ decls_match (tree newdecl, tree olddecl, { if (!prototype_p (f2) && DECL_EXTERN_C_P (olddecl) && (DECL_BUILT_IN (olddecl) -#ifndef NO_IMPLICIT_EXTERN_C +#ifdef SYSTEM_IMPLICIT_EXTERN_C || (DECL_IN_SYSTEM_HEADER (newdecl) && !DECL_CLASS_SCOPE_P (newdecl)) || (DECL_IN_SYSTEM_HEADER (olddecl) && !DECL_CLASS_SCOPE_P (olddecl)) #endif @@ -977,7 +977,7 @@ decls_match (tree newdecl, tree olddecl, if (p1 == void_list_node) TREE_TYPE (newdecl) = TREE_TYPE (olddecl); } -#ifndef NO_IMPLICIT_EXTERN_C +#ifdef SYSTEM_IMPLICIT_EXTERN_C else if (!prototype_p (f1) && (DECL_EXTERN_C_P (olddecl) && DECL_IN_SYSTEM_HEADER (olddecl) Index: cp/parser.c =================================================================== --- cp/parser.c (revision 262020) +++ cp/parser.c (working copy) @@ -21349,7 +21349,7 @@ cp_parser_parameter_declaration_clause ( else if (token->type == CPP_CLOSE_PAREN) /* There are no parameters. */ { -#ifndef NO_IMPLICIT_EXTERN_C +#ifdef SYSTEM_IMPLICIT_EXTERN_C if (in_system_header_at (input_location) && current_class_type == NULL && current_lang_name == lang_name_c) Index: doc/cpp.texi =================================================================== --- doc/cpp.texi (revision 262020) +++ doc/cpp.texi (working copy) @@ -3735,7 +3735,7 @@ so certain warnings should be suppressed @item 4 This indicates that the following text should be treated as being wrapped in an implicit @code{extern "C"} block. -@c maybe cross reference NO_IMPLICIT_EXTERN_C +@c maybe cross reference SYSTEM_IMPLICIT_EXTERN_C @end table As an extension, the preprocessor accepts linemarkers in non-assembler Index: doc/extend.texi =================================================================== --- doc/extend.texi (revision 262020) +++ doc/extend.texi (working copy) @@ -23450,7 +23450,7 @@ deprecated. @xref{Deprecated Features} @item Implicit C language Old C system header files did not contain an @code{extern "C" @{@dots{}@}} -scope to set the language. On such systems, all header files are +scope to set the language. On such systems, all system header files are implicitly scoped inside a C language scope. Also, an empty prototype @code{()} is treated as an unspecified number of arguments, rather than no arguments, as C++ demands. Index: doc/tm.texi =================================================================== --- doc/tm.texi (revision 262020) +++ doc/tm.texi (working copy) @@ -11149,11 +11149,10 @@ Define this hook to return the name of a Define this hook to add target-specific C++ implicit extern C functions. If this function returns true for the name of a file-scope function, that function implicitly gets extern "C" linkage rather than whatever language linkage the declaration would normally have. An example of such function is WinMain on Win32 targets. @end deftypefn -@defmac NO_IMPLICIT_EXTERN_C -Define this macro if the system header files support C++ as well as C@. -This macro inhibits the usual method of using system header files in -C++, which is to pretend that the file's contents are enclosed in -@samp{extern "C" @{@dots{}@}}. +@defmac SYSTEM_IMPLICIT_EXTERN_C +Define this macro if the system header files do not support C++@. +This macro handles system header files by pretending that system +header files are enclosed in @samp{extern "C" @{@dots{}@}}. @end defmac @findex #pragma Index: doc/tm.texi.in =================================================================== --- doc/tm.texi.in (revision 262020) +++ doc/tm.texi.in (working copy) @@ -7657,11 +7657,10 @@ files @code{__STDC__} will always expand @hook TARGET_CXX_IMPLICIT_EXTERN_C -@defmac NO_IMPLICIT_EXTERN_C -Define this macro if the system header files support C++ as well as C@. -This macro inhibits the usual method of using system header files in -C++, which is to pretend that the file's contents are enclosed in -@samp{extern "C" @{@dots{}@}}. +@defmac SYSTEM_IMPLICIT_EXTERN_C +Define this macro if the system header files do not support C++@. +This macro handles system header files by pretending that system +header files are enclosed in @samp{extern "C" @{@dots{}@}}. @end defmac @findex #pragma Index: system.h =================================================================== --- system.h (revision 262020) +++ system.h (working copy) @@ -1025,7 +1025,7 @@ extern void fancy_abort (const char *, i LIBGCC2_LONG_DOUBLE_TYPE_SIZE STRUCT_VALUE \ EH_FRAME_IN_DATA_SECTION TARGET_FLT_EVAL_METHOD_NON_DEFAULT \ JCR_SECTION_NAME TARGET_USE_JCR_SECTION SDB_DEBUGGING_INFO \ - SDB_DEBUG + SDB_DEBUG NO_IMPLICIT_EXTERN_C /* Hooks that are no longer used. */ #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \