public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aladjev.andrew at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/99741] New: dllexport attribute is not compatible with c99 inline
Date: Tue, 23 Mar 2021 21:48:24 +0000	[thread overview]
Message-ID: <bug-99741-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99741

            Bug ID: 99741
           Summary: dllexport attribute is not compatible with c99 inline
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aladjev.andrew at gmail dot com
  Target Milestone: ---

Created attachment 50466
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50466&action=edit
fit.tar.gz

Hello, please review the following cmake issue here
https://gitlab.kitware.com/cmake/cmake/-/issues/21940#note_925715.

I am trying to create cross platform application, than I need to compile it
using MSVC. MSVC requires mandatory dllexport and dllimport attributes for all
functions including C99 inline functions. Clang is completely ignoring these
attributes in GNU env and it is always successful
https://github.com/llvm/llvm-project/commit/606bd6dcc547cf2f9fd7387321db79419bf60041.
GCC ignores only dllimport attribute, but fails with dllexport attribute.

Please review simplified project: a1.h, a1.c, a2.c and CMakeLists.txt attached.
You can try to build it on windows using:

CC="gcc" cmake -G "Unix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=1 . && make
CC="clang" cmake -G "Unix Makefiles" -DCMAKE_VERBOSE_MAKEFILE=1 . && make

GCC provides error: multiple definition of func. I can't understand the reason
of this error: maybe dllexport converted C99 inline declaration into C89?

Workaround for this issue is to remove dllexport attribute for windows platform
+ gcc on makefile generator layer (cmake/etc).

PS this issue is indirectly related to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90161

             reply	other threads:[~2021-03-23 21:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 21:48 aladjev.andrew at gmail dot com [this message]
2021-03-23 21:53 ` [Bug c/99741] " aladjev.andrew at gmail dot com
2023-12-04 10:16 ` [Bug target/99741] " egallager at gcc dot gnu.org

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=bug-99741-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).