Skip to content

[MS Bugs] char/signed char decl compatibility. #9260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Bigcheese opened this issue Jan 3, 2011 · 2 comments
Closed

[MS Bugs] char/signed char decl compatibility. #9260

Bigcheese opened this issue Jan 3, 2011 · 2 comments
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category

Comments

@Bigcheese
Copy link
Contributor

Bugzilla Link 8888
Resolution FIXED
Resolved on Jul 26, 2014 14:16
Version trunk
OS All
Blocks llvm/llvm-bugzilla-archive#13707
CC @AaronBallman,@tritao,@nico

Extended Description

MSVC allows the following in C mode (in C++ it's always legal because of overloading) while clang (correctly) does not. Clang should support this in ms-extensions mode, although I do not yet know the exact semantics (does it use signed or unsigned?).

int __cdecl _access( const char * _Filename, int _AccessMode);
int __cdecl _access( const signed char *path,int amode)
{
return 0;
}

C:\Users\Michael\Projects\msvcrt\research>clang -fsyntax-only double-decl.c
double-decl.c(2) : error: conflicting types for '_access'
int __cdecl _access( const signed char *path,int amode)
^
double-decl.c(1) : note: previous declaration is here
int __cdecl _access( const char * _Filename, int _AccessMode);
^
1 error generated.

C:\Users\Michael\Projects\msvcrt\research>clang++ -fsyntax-only -x c++ double-decl.c

C:\Users\Michael\Projects\msvcrt\research>cl -Zs double-decl.c -nologo

@AaronBallman
Copy link
Collaborator

The semantics depend on the presence of the /J switch.

http://msdn.microsoft.com/en-us/library/0d294k5z.aspx

By default (without /J), char is signed. With /J, it sets _CHAR_UNSIGNED and char defaults to unsigned.

@nico
Copy link
Contributor

nico commented Jul 26, 2014

Looks like we fixed this:

Nicos-MacBook-Pro:llvm-rw thakis$ cat test.cc
int __cdecl _access( const char * _Filename, int _AccessMode);
int __cdecl _access( const signed char *path,int amode)
{
return 0;
}
Nicos-MacBook-Pro:llvm-rw thakis$ ../llvm-build/bin/clang-cl /c test.cc

(clang-cl supports /J too.)

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang Clang issues not falling into any other category
Projects
None yet
Development

No branches or pull requests

3 participants