[LLVMbugs] [Bug 20746] clang fails to parse mingw-w64's secure api headers (cannot add 'dllimport' attribute)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Oct 26 04:56:35 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20746

Thomas Pöchtrager <t.poechtrager at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #14 from Thomas Pöchtrager <t.poechtrager at gmail.com> ---
There is still an issue with 'extern "C"':

--

$ cat test.c
typedef struct localeinfo_struct {
  char dummy;
} _locale_tstruct,*_locale_t;

#ifdef __cplusplus
extern "C" {
#endif
  int __attribute__((__cdecl__)) _scanf_l(const char * __restrict__
format,_locale_t locale,... ) ;
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
  __attribute__ ((__dllimport__)) int __attribute__((__cdecl__)) _scanf_l(const
char *_Format,_locale_t _Locale,...);
#ifdef __cplusplus
}
#endif

--

$ clang -target i686-w64-mingw32 test.c -fsyntax-only
test.c:16:66: warning: redeclaration of '_scanf_l' should not add 'dllimport'
attribute [-Wdll-attribute-on-redeclaration]
  __attribute__ ((__dllimport__)) int __attribute__((__cdecl__)) _scanf_l(const
char *_Format,_locale_t _Locale,...);
                                                                 ^
test.c:8:34: note: previous declaration is here
  int __attribute__((__cdecl__)) _scanf_l(const char * __restrict__
format,_locale_t locale,... ) ;
                                 ^
1 warning generated.

--

$ clang++ -target i686-w64-mingw32 -xc++ test.c -fsyntax-only
test.c:16:66: error: redeclaration of '_scanf_l' cannot add 'dllimport'
attribute
  __attribute__ ((__dllimport__)) int __attribute__((__cdecl__)) _scanf_l(const
char *_Format,_locale_t _Locale,...);
                                                                 ^
test.c:8:34: note: previous declaration is here
  int __attribute__((__cdecl__)) _scanf_l(const char * __restrict__
format,_locale_t locale,... ) ;
                                 ^
1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141026/0f5f7dc0/attachment.html>


More information about the llvm-bugs mailing list