From patchwork Mon Oct 2 08:58:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 820392 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-463310-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="v51G0Omy"; 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 3y5GLN467xz9t4Z for ; Mon, 2 Oct 2017 19:59:08 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:cc:content-type; q=dns; s=default; b=d7Dys+uAq2GEMZ+GL0zupVrvfOJm3GzgcZy+F06uO+Z PL1SVXXuKW57kMEzfn10nXmBy4CZ5xMBsI2NE/ZFVXmbBPa0IJSV16/hlfHXeVc+ rNNy7igwHwc8APRZMOzDFSbuhb7jQTidLFU6VyCIQ2kGzz3RCWKK6lnkDJbPOyJ4 = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:cc:content-type; s=default; bh=7Y/S3Pu/DWdgNX1XjgUy++QIOYQ=; b=v51G0Omyw1r8wl/xq hHHU+8P9tD32j+pEQU67UY97pB3JzjEdEdnW0UUEteUSqToy4PPoH8bpEAOF07aZ mf8s01rUIkZQiq2Brk7q3KE0BZNBsAjBJ5dIn9Idt4EDdYDUjTDyB0PJV5THqDZ1 LwHpBAt0lF9YXsHSrSESiwNoes= Received: (qmail 49212 invoked by alias); 2 Oct 2017 08:58:29 -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 49184 invoked by uid 89); 2 Oct 2017 08:58:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=JIT X-HELO: mail-qk0-f179.google.com Received: from mail-qk0-f179.google.com (HELO mail-qk0-f179.google.com) (209.85.220.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Oct 2017 08:58:26 +0000 Received: by mail-qk0-f179.google.com with SMTP id b15so2377662qkg.9 for ; Mon, 02 Oct 2017 01:58:26 -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:sender:from:date:message-id:subject :to:cc; bh=F+r8ceHn0L2L1GQXAJihHUPaeDQuMM9dSGsxllzoSlg=; b=W9OPG3Vh1UGkN1nNJHHwi6K/69BlSHkW72TSCcR9EvADaGm0QyWENqF4bg7zzV+gQR 6QqLduJPJgyZgG5/JIG6MhcNrvJlYuv2pyVUAUYU5TYGceCBILn+Y9GA+n0zsHsbdfGx 6THYVCSayIdZ6s04yT87eGFyYUZv8ZoQcj6Fi0fuw+KuAD8H6WBqaIftPbDhgI2Y/j56 wok2DXG1h6CLbjFAthbYZHnMykk7thkB+SDHFGYxEZCdEtXxtlnM9ErBOvpxbpBKs6yd P0Bgpeqm1q9AX6y98WoyCp6J8cCXjqxIgP2FBKhspUWc+DtT5sWhXoV55a3+EOkUo4VO p9wA== X-Gm-Message-State: AMCzsaUToRXAH53EfDYANnGxTXEYpTtIyOwEvGL4SBmP6rg18NSwBV4J inSbH+spGoIlYwlCUYEKlnFCSe2BilqGhF0Gey8= X-Google-Smtp-Source: AOwi7QDZrUDN63VnrjR8Bgtps2t+5/5esdj5Xa5KiC6Ir185GLMLjgcvAww6/8sy70VJdF8GA/W38drL1opsXzBQPhw= X-Received: by 10.55.23.131 with SMTP id 3mr11838821qkx.237.1506934705183; Mon, 02 Oct 2017 01:58:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.172.6 with HTTP; Mon, 2 Oct 2017 01:58:23 -0700 (PDT) From: Iain Buclaw Date: Mon, 2 Oct 2017 10:58:23 +0200 Message-ID: Subject: [PATCH v3 6/14] D: Add D language support to GCC proper. To: Jeff Law Cc: Mike Stump , gcc-patches X-IsSubscribed: yes No changes from previous, just rebased against trunk. Regards Iain gcc/ChangeLog * config/powerpcspe/powerpcspe.c (rs6000_output_function_epilogue): Support GNU D by using 0 as the language type. * config/rs6000/rs6000.c (rs6000_output_function_epilogue): Support GNU D by using 0 as the language type. * dwarf2out.c (is_dlang): New function. (gen_compile_unit_die): Use DW_LANG_D for D. (declare_in_namespace): Return module die for D, instead of adding extra declarations into the namespace. (gen_namespace_die): Generate DW_TAG_module for D. (gen_decl_die, dwarf2out_decl): Handle CONST_DECLSs for D. * gcc.c (default_compilers): Add entries for ".d", ".dd" and ".di". gcc/po/ChangeLog: * EXCLUDES: Add sources from d/dfrontend. diff --git a/gcc/config/powerpcspe/powerpcspe.c b/gcc/config/powerpcspe/powerpcspe.c index 12af88417ba..b322b91a652 100644 --- a/gcc/config/powerpcspe/powerpcspe.c +++ b/gcc/config/powerpcspe/powerpcspe.c @@ -32019,11 +32019,12 @@ rs6000_output_function_epilogue (FILE *file) use language_string. C is 0. Fortran is 1. Pascal is 2. Ada is 3. C++ is 9. Java is 13. Objective-C is 14. Objective-C++ isn't assigned - a number, so for now use 9. LTO, Go and JIT aren't assigned numbers - either, so for now use 0. */ + a number, so for now use 9. LTO, Go, D and JIT aren't assigned + numbers either, so for now use 0. */ if (lang_GNU_C () || ! strcmp (language_string, "GNU GIMPLE") || ! strcmp (language_string, "GNU Go") + || ! strcmp (language_string, "GNU D") || ! strcmp (language_string, "libgccjit")) i = 0; else if (! strcmp (language_string, "GNU F77") diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 1e794a0faa6..3e1cfc65ad7 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -29214,11 +29214,12 @@ rs6000_output_function_epilogue (FILE *file) use language_string. C is 0. Fortran is 1. Pascal is 2. Ada is 3. C++ is 9. Java is 13. Objective-C is 14. Objective-C++ isn't assigned - a number, so for now use 9. LTO, Go and JIT aren't assigned numbers - either, so for now use 0. */ + a number, so for now use 9. LTO, Go, D, and JIT aren't assigned + numbers either, so for now use 0. */ if (lang_GNU_C () || ! strcmp (language_string, "GNU GIMPLE") || ! strcmp (language_string, "GNU Go") + || ! strcmp (language_string, "GNU D") || ! strcmp (language_string, "libgccjit")) i = 0; else if (! strcmp (language_string, "GNU F77") diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index e97ceb61b46..732851faf36 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -5176,6 +5176,16 @@ is_ada (void) return lang == DW_LANG_Ada95 || lang == DW_LANG_Ada83; } +/* Return TRUE if the language is D. */ + +static inline bool +is_dlang (void) +{ + unsigned int lang = get_AT_unsigned (comp_unit_die (), DW_AT_language); + + return lang == DW_LANG_D; +} + /* Remove the specified attribute if present. Return TRUE if removal was successful. */ @@ -23535,6 +23545,8 @@ gen_compile_unit_die (const char *filename) language = DW_LANG_ObjC; else if (strcmp (language_string, "GNU Objective-C++") == 0) language = DW_LANG_ObjC_plus_plus; + else if (strcmp (language_string, "GNU D") == 0) + language = DW_LANG_D; else if (dwarf_version >= 5 || !dwarf_strict) { if (strcmp (language_string, "GNU Go") == 0) @@ -25138,7 +25150,7 @@ declare_in_namespace (tree thing, dw_die_ref context_die) if (ns_context != context_die) { - if (is_fortran ()) + if (is_fortran () || is_dlang ()) return ns_context; if (DECL_P (thing)) gen_decl_die (thing, NULL, NULL, ns_context); @@ -25161,7 +25173,7 @@ gen_namespace_die (tree decl, dw_die_ref context_die) { /* Output a real namespace or module. */ context_die = setup_namespace_context (decl, comp_unit_die ()); - namespace_die = new_die (is_fortran () + namespace_die = new_die (is_fortran () || is_dlang () ? DW_TAG_module : DW_TAG_namespace, context_die, decl); /* For Fortran modules defined in different CU don't add src coords. */ @@ -25233,7 +25245,7 @@ gen_decl_die (tree decl, tree origin, struct vlr_context *ctx, break; case CONST_DECL: - if (!is_fortran () && !is_ada ()) + if (!is_fortran () && !is_ada () && !is_dlang ()) { /* The individual enumerators of an enum type get output when we output the Dwarf representation of the relevant enum type itself. */ @@ -25807,7 +25819,7 @@ dwarf2out_decl (tree decl) case CONST_DECL: if (debug_info_level <= DINFO_LEVEL_TERSE) return; - if (!is_fortran () && !is_ada ()) + if (!is_fortran () && !is_ada () && !is_dlang ()) return; if (TREE_STATIC (decl) && decl_function_context (decl)) context_die = lookup_decl_die (DECL_CONTEXT (decl)); diff --git a/gcc/gcc.c b/gcc/gcc.c index cec3ed5be5f..44896630e5e 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1307,6 +1307,7 @@ static const struct compiler default_compilers[] = {".f08", "#Fortran", 0, 0, 0}, {".F08", "#Fortran", 0, 0, 0}, {".r", "#Ratfor", 0, 0, 0}, {".go", "#Go", 0, 1, 0}, + {".d", "#D", 0, 1, 0}, {".dd", "#D", 0, 1, 0}, {".di", "#D", 0, 1, 0}, /* Next come the entries for C. */ {".c", "@c", 0, 0, 1}, {"@c", diff --git a/gcc/po/EXCLUDES b/gcc/po/EXCLUDES index da6906552bd..2f8e4f40489 100644 --- a/gcc/po/EXCLUDES +++ b/gcc/po/EXCLUDES @@ -53,3 +53,43 @@ genrecog.c gensupport.c gensupport.h read-md.c + +# These files are part of the front end to D, and have no i18n support. +d/dfrontend/arrayop.c +d/dfrontend/attrib.c +d/dfrontend/canthrow.c +d/dfrontend/cond.c +d/dfrontend/constfold.c +d/dfrontend/cppmangle.c +d/dfrontend/ctfeexpr.c +d/dfrontend/dcast.c +d/dfrontend/dclass.c +d/dfrontend/declaration.c +d/dfrontend/denum.c +d/dfrontend/dimport.c +d/dfrontend/dinterpret.c +d/dfrontend/dmangle.c +d/dfrontend/dmodule.c +d/dfrontend/doc.c +d/dfrontend/dscope.c +d/dfrontend/dstruct.c +d/dfrontend/dsymbol.c +d/dfrontend/dtemplate.c +d/dfrontend/dversion.c +d/dfrontend/expression.c +d/dfrontend/func.c +d/dfrontend/init.c +d/dfrontend/inline.c +d/dfrontend/lexer.c +d/dfrontend/mtype.c +d/dfrontend/nogc.c +d/dfrontend/nspace.c +d/dfrontend/objc.c +d/dfrontend/opover.c +d/dfrontend/optimize.c +d/dfrontend/parse.c +d/dfrontend/sideeffect.c +d/dfrontend/statement.c +d/dfrontend/statementsem.c +d/dfrontend/staticassert.c +d/dfrontend/traits.c