Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 27, 2013 DMD source violates c++11 standards. | ||||
---|---|---|---|---|
| ||||
This also makes compiling LDC with clang rather difficult [ 1%] Building CXX object CMakeFiles/LDCShared.dir/dmd2/func.c.o /root/llvm/src/ldc/dmd2/func.c:540:18: error: case value evaluates to -2, which cannot be narrowed to type 'size_t' (aka 'unsigned long') [-Wc++11-narrowing] case -2: // can't determine because of fwd refs ^ /root/llvm/src/ldc/dmd2/func.c:503:18: error: case value evaluates to -1, which cannot be narrowed to type 'size_t' (aka 'unsigned long') [-Wc++11-narrowing] case -1: ^ /root/llvm/src/ldc/dmd2/func.c:632:22: error: case value evaluates to -2, which cannot be narrowed to type 'size_t' (aka 'unsigned long') [-Wc++11-narrowing] case -2: ^ /root/llvm/src/ldc/dmd2/func.c:629:22: error: case value evaluates to -1, which cannot be narrowed to type 'size_t' (aka 'unsigned long') [-Wc++11-narrowing] case -1: |
May 27, 2013 Re: DMD source violates c++11 standards. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hans W. Uhlig | "Hans W. Uhlig" <huhlig@gmail.com> wrote in message news:idtvbddofuxwpsbtowsj@forum.dlang.org... > This also makes compiling LDC with clang rather difficult > DMD is not written in C++11. Turning of the C++11 warnings in clang will fix this problem. |
May 28, 2013 Re: DMD source violates c++11 standards. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On 5/27/2013 4:47 PM, Daniel Murphy wrote:
> "Hans W. Uhlig" <huhlig@gmail.com> wrote in message
> news:idtvbddofuxwpsbtowsj@forum.dlang.org...
>> This also makes compiling LDC with clang rather difficult
>>
>
> DMD is not written in C++11. Turning of the C++11 warnings in clang will
> fix this problem.
>
>
Also, you can submit a bugzilla entry for it, or even a pull request. There's no reason for such code in DMD to remain.
|
May 28, 2013 Re: DMD source violates c++11 standards. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tuesday, 28 May 2013 at 00:12:57 UTC, Walter Bright wrote:
> On 5/27/2013 4:47 PM, Daniel Murphy wrote:
>> "Hans W. Uhlig" <huhlig@gmail.com> wrote in message
>> news:idtvbddofuxwpsbtowsj@forum.dlang.org...
>>> This also makes compiling LDC with clang rather difficult
>>>
>>
>> DMD is not written in C++11. Turning of the C++11 warnings in clang will
>> fix this problem.
>>
>>
>
> Also, you can submit a bugzilla entry for it, or even a pull request. There's no reason for such code in DMD to remain.
I was thinking about that: surely D's mature enough that dmd can be written in D?
|
May 28, 2013 Re: DMD source violates c++11 standards. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy Attachments:
| On Mon, May 27, 2013 at 4:47 PM, Daniel Murphy <yebblies@nospamgmail.com>wrote: > DMD is not written in C++11. Turning of the C++11 warnings in clang will fix this problem True, but could it not be the case that, since there might be stricter type checking included, certain errors might show up? Like the example above, where a switch is being done on an unsigned type, and negative cases are being handled. -- Ziad |
May 28, 2013 Re: DMD source violates c++11 standards. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Borden | On Tuesday, May 28, 2013 02:15:39 Borden wrote:
> I was thinking about that: surely D's mature enough that dmd can be written in D?
Work is being done to convert it to D, but there's a fair bit of work to do for it to happen (like improving what extern(C++) can do so that it can better integrate with the various backends).
- Jonathan M Davis
|
May 28, 2013 Re: DMD source violates c++11 standards. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hans W. Uhlig | Prepping a patch for dmd to correct some of the C++11 Correctness issues. I came across this set and am a bit hesitant to change it without knowing side effects. /home/huhlig/Temp/d/ldc/dmd2/struct.c:239:14: error: case value evaluates to -1, which cannot be narrowed to type 'structalign_t' (aka 'unsigned int') [-Wc++11-narrowing] case STRUCTALIGN_DEFAULT: ^ /home/huhlig/Temp/d/ldc/dmd2/mars.h:308:29: note: expanded from macro 'STRUCTALIGN_DEFAULT' #define STRUCTALIGN_DEFAULT ~0 // magic value means "match whatever the underlying C compiler does" void AggregateDeclaration::alignmember( structalign_t alignment, // struct alignment that is in effect unsigned size, // alignment requirement of field unsigned *poffset) { //printf("alignment = %d, size = %d, offset = %d\n",alignment,size,offset); switch (alignment) { case 1: // No alignment break; case STRUCTALIGN_DEFAULT: { /* Must match what the corresponding C compiler's default * alignment behavior is. */ assert(size != 3); unsigned sa = (size == 0 || 8 < size) ? 8 : size; *poffset = (*poffset + sa - 1) & ~(sa - 1); break; } default: // Align on alignment boundary, which must be a positive power of 2 assert(alignment > 0 && !(alignment & (alignment - 1))); *poffset = (*poffset + alignment - 1) & ~(alignment - 1); break; } } |
May 28, 2013 Re: DMD source violates c++11 standards. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hans W. Uhlig | On Monday, 27 May 2013 at 23:25:37 UTC, Hans W. Uhlig wrote:
> This also makes compiling LDC with clang rather difficult
>
> [ 1%] Building CXX object CMakeFiles/LDCShared.dir/dmd2/func.c.o
> /root/llvm/src/ldc/dmd2/func.c:540:18: error: case value evaluates to -2, which cannot be narrowed to type 'size_t' (aka 'unsigned long') [-Wc++11-narrowing]
> case -2: // can't determine because of fwd refs
> ^
> /root/llvm/src/ldc/dmd2/func.c:503:18: error: case value evaluates to -1, which cannot be narrowed to type 'size_t' (aka 'unsigned long') [-Wc++11-narrowing]
> case -1:
> ^
> /root/llvm/src/ldc/dmd2/func.c:632:22: error: case value evaluates to -2, which cannot be narrowed to type 'size_t' (aka 'unsigned long') [-Wc++11-narrowing]
> case -2:
> ^
> /root/llvm/src/ldc/dmd2/func.c:629:22: error: case value evaluates to -1, which cannot be narrowed to type 'size_t' (aka 'unsigned long') [-Wc++11-narrowing]
> case -1:
There were discussions raised in the past about dmd source compile warnings which are generated by enabling some warning options. Depending on which switches are turned on, compiler can produce from 100 up to 10_000 warnings. Most of them are useless since they do not perform flow analysis (for example, those complains about variables may being not initialized which ignore assertions) or are issued in dirty backend code. It is extremly unlikely to extract something worth fixing from such large amount of messages. Dmd sources are at everyday look of dozen developers, so there is low probability to get from warnings something useful which solves potential problem.
I use conservative number of warning switches which produces two warnings in current dmd git sources - one about obsolete cast from string type to char*, and the second about ignoring __cdecl attribute. I don't bother to fix them.
|
May 28, 2013 Re: DMD source violates c++11 standards. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Maxim Fomin | On Tuesday, 28 May 2013 at 19:33:08 UTC, Maxim Fomin wrote:
> On Monday, 27 May 2013 at 23:25:37 UTC, Hans W. Uhlig wrote:
>> This also makes compiling LDC with clang rather difficult
>>
>> [ 1%] Building CXX object CMakeFiles/LDCShared.dir/dmd2/func.c.o
>> /root/llvm/src/ldc/dmd2/func.c:540:18: error: case value evaluates to -2, which cannot be narrowed to type 'size_t' (aka 'unsigned long') [-Wc++11-narrowing]
>> case -2: // can't determine because of fwd refs
>> ^
>> /root/llvm/src/ldc/dmd2/func.c:503:18: error: case value evaluates to -1, which cannot be narrowed to type 'size_t' (aka 'unsigned long') [-Wc++11-narrowing]
>> case -1:
>> ^
>> /root/llvm/src/ldc/dmd2/func.c:632:22: error: case value evaluates to -2, which cannot be narrowed to type 'size_t' (aka 'unsigned long') [-Wc++11-narrowing]
>> case -2:
>> ^
>> /root/llvm/src/ldc/dmd2/func.c:629:22: error: case value evaluates to -1, which cannot be narrowed to type 'size_t' (aka 'unsigned long') [-Wc++11-narrowing]
>> case -1:
>
> There were discussions raised in the past about dmd source compile warnings which are generated by enabling some warning options. Depending on which switches are turned on, compiler can produce from 100 up to 10_000 warnings. Most of them are useless since they do not perform flow analysis (for example, those complains about variables may being not initialized which ignore assertions) or are issued in dirty backend code. It is extremly unlikely to extract something worth fixing from such large amount of messages. Dmd sources are at everyday look of dozen developers, so there is low probability to get from warnings something useful which solves potential problem.
>
> I use conservative number of warning switches which produces two warnings in current dmd git sources - one about obsolete cast from string type to char*, and the second about ignoring __cdecl attribute. I don't bother to fix them.
These are just from the standard set of clang switched while trying to compile LDC.
|
May 28, 2013 Re: DMD source violates c++11 standards. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hans W. Uhlig | On Tuesday, 28 May 2013 at 19:56:40 UTC, Hans W. Uhlig wrote:
> These are just from the standard set of clang switched while trying to compile LDC.
More precisely, they are pulled in from the LLVM compiler flags
(llvm-config --cxxflags) if LLVM was compiled with --enable-cxx11.
David
|
Copyright © 1999-2021 by the D Language Foundation