On Sunday, 10 May 2015 at 17:45:30 UTC, Johannes Pfau wrote:
I've just opened a pull request for -fno-rtti at [1]. The frontend part needs to go into DMD but I'd like some testing feedback first. This is
especially important as I had literally no time to test this
updated code ;-) Please provide feedback here or at [1].
Thanks for doing this!

I tested my LCD demo and I get the following errors,

Compiler command
----------------
arm-none-eabi-gdc -c -O3 -nophoboslib -nostdinc -nodefaultlibs -nostdlib -mthumb -mcpu=cortex-m4 -fno-bounds-check -fno-invariants -fno-in -fno-out -fno-emit-moduleinfo -fno-rtti -ffunction-sections -fdata-sections {some_imports} {my_source_files} -o binary/firmware.o
Compiler output
---------------
source/stm32f42/trace.d:58:5: error: Can't use array literal: TypeInfo disabled using -fno-rtti switch.
     [
     ^
cc1d: error: Can't use typeid: TypeInfo disabled using -fno-rtti switch. source/gcc/attribute.d:10:12: error: template instance gcc.attribute.Attribute!string error instantiating
     return Attribute!A(args);
            ^
source/gcc/attribute.d:13:45: note: instantiated from here: attribute!(string)
 public enum inline = gcc.attribute.attribute("forceinline");


Here's the code causing the error
---------------------------------

https://github.com/JinShil/stm32f42_discovery_demo/blob/master/source/stm32f42/trace.d#L57
private void semihostingWrite(in void* ptr, in uint length)
{
  uint[3] message = [ 2, cast(uint)ptr, length];  // line 58
  semihostingInvoke(0x05, &message);
}

// attribute.d
/*************/
private struct Attribute(A...)
{
  A args;
}

https://github.com/JinShil/stm32f42_discovery_demo/blob/master/source/gcc/attribute.d
auto attribute(A...)(A args) if(A.length > 0 && is(A[0] == string))
{
  // line 10
  return Attribute!A(args);
}

//line 13
public enum inline = gcc.attribute.attribute("forceinline");
public enum naked = gcc.attribute.attribute("naked");


Without the -fno-rtti switch, everything builds fine.

Mike

Reply via email to