digitalmars.D - DMD source violates c++11 standards.
- Hans W. Uhlig (21/21) May 27 2013 This also makes compiling LDC with clang rather difficult
- Daniel Murphy (4/5) May 27 2013 DMD is not written in C++11. Turning of the C++11 warnings in clang wil...
- Walter Bright (3/9) May 27 2013 Also, you can submit a bugzilla entry for it, or even a pull request. Th...
- Borden (3/16) May 27 2013 I was thinking about that: surely D's mature enough that dmd can
- Jonathan M Davis (5/7) May 27 2013 Work is being done to convert it to D, but there's a fair bit of work to...
- Ziad Hatahet (7/9) May 27 2013 True, but could it not be the case that, since there might be stricter t...
- Hans W. Uhlig (48/48) May 28 2013 Prepping a patch for dmd to correct some of the C++11 Correctness
- Maxim Fomin (16/38) May 28 2013 There were discussions raised in the past about dmd source
- Hans W. Uhlig (3/42) May 28 2013 These are just from the standard set of clang switched while
- David Nadlinger (4/6) May 28 2013 More precisely, they are pulled in from the LLVM compiler flags
- David Nadlinger (6/9) May 28 2013 (i.e. the C++11 mode switch)
- Hans W. Uhlig (5/14) May 28 2013 There is one Error on the LDC Side.
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
"Hans W. Uhlig" <huhlig gmail.com> wrote in message news:idtvbddofuxwpsbtowsj forum.dlang.org...This also makes compiling LDC with clang rather difficultDMD is not written in C++11. Turning of the C++11 warnings in clang will fix this problem.
May 27 2013
On 5/27/2013 4:47 PM, Daniel Murphy wrote:"Hans W. Uhlig" <huhlig gmail.com> wrote in message news:idtvbddofuxwpsbtowsj forum.dlang.org...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.This also makes compiling LDC with clang rather difficultDMD is not written in C++11. Turning of the C++11 warnings in clang will fix this problem.
May 27 2013
On Tuesday, 28 May 2013 at 00:12:57 UTC, Walter Bright wrote:On 5/27/2013 4:47 PM, Daniel Murphy wrote:I was thinking about that: surely D's mature enough that dmd can be written in D?"Hans W. Uhlig" <huhlig gmail.com> wrote in message news:idtvbddofuxwpsbtowsj forum.dlang.org...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.This also makes compiling LDC with clang rather difficultDMD is not written in C++11. Turning of the C++11 warnings in clang will fix this problem.
May 27 2013
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 27 2013
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 problemTrue, 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 27 2013
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
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
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:These are just from the standard set of clang switched while trying to compile LDC.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
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
May 28 2013
On Tuesday, 28 May 2013 at 21:16:44 UTC, David Nadlinger wrote:More precisely, they are pulled in from the LLVM compiler flags (llvm-config --cxxflags) if LLVM was compiled with --enable-cxx11.(i.e. the C++11 mode switch) I'd much prefer for this one to be resolved in the DMD source instead of as a hack on the LDC side, as there really isn't much reason not to. David
May 28 2013
On Tuesday, 28 May 2013 at 21:21:57 UTC, David Nadlinger wrote:On Tuesday, 28 May 2013 at 21:16:44 UTC, David Nadlinger wrote:There is one Error on the LDC Side. dmd2/mars.c:106: --- llvm_version = "LLVM "LDC_LLVM_VERSION_STRING; +++ llvm_version = "LLVM " LDC_LLVM_VERSION_STRING;More precisely, they are pulled in from the LLVM compiler flags (llvm-config --cxxflags) if LLVM was compiled with --enable-cxx11.(i.e. the C++11 mode switch) I'd much prefer for this one to be resolved in the DMD source instead of as a hack on the LDC side, as there really isn't much reason not to. David
May 28 2013