public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: LIU Hao <lh_mouse@126.com>
To: i.nixman@autistici.org, Xi Ruoyao <xry111@xry111.site>,
	Gcc Help <gcc-help@gcc.gnu.org>
Subject: Re: undefined reference when building GCC-4.8.1 MinGW-W64
Date: Wed, 7 Sep 2022 22:35:50 +0800	[thread overview]
Message-ID: <16cbc1f5-3d61-ac17-7873-65abfb91c848@126.com> (raw)
In-Reply-To: <877780c3b766c3317259c8de38f2b11f@autistici.org>


[-- Attachment #1.1: Type: text/plain, Size: 1523 bytes --]

在 2022-09-07 19:04, i.nixman--- via Gcc-help 写道:
> 
> great, but without that patch I still get the error:
> 
> In file included from ../../../../src/gcc-4.8.1/gcc/cp/except.c:1005:
> cfns.gperf:101:1: error: 'const char* libc_name_p(const char*, unsigned int)' redeclared inline with 
> 'gnu_inline' attribute
> cfns.gperf:26:14: note: 'const char* libc_name_p(const char*, unsigned int)' previously declared here
> cfns.gperf:26:14: warning: inline function 'const char* libc_name_p(const char*, unsigned int)' used 
> but never defined

For the sake of simplicity, I suspect it is possible to make `libc_name_p()` a `static __inline` 
function, as I see it be referenced only ever once in 'except.c'.

When attempting to compile 'except.c' as C++ with GCC 4.8 and with the patch which you have 
mentioned, this function is a `gnu_inline` function with an implicit `extern` [1], so rule 1.3 [2] 
applies: Because optimization is not enabled, a call to an external function is emitted; and because 
no out-of-line definition is available, undefined reference is the result.

Use of the `gnu_inline` attribute on an `extern` function requires there be a definition that is 
compiled without `gnu_inline` or `inline`. Probably it can be removed when `__cplusplus` is defined.


[1] This differs from C, where `inline` has a distinct meaning from `extern inline`.
[2] https://github.com/lhmouse/mcfgthread/wiki/Differences-between-GNU,-C99-and-C---%60inline%60


-- 
Best regards,
LIU Hao

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

      reply	other threads:[~2022-09-07 14:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 11:23 i.nixman
2022-09-06 11:36 ` i.nixman
2022-09-06 12:54   ` Xi Ruoyao
2022-09-07 11:04     ` i.nixman
2022-09-07 14:35       ` LIU Hao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16cbc1f5-3d61-ac17-7873-65abfb91c848@126.com \
    --to=lh_mouse@126.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=i.nixman@autistici.org \
    --cc=xry111@xry111.site \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).