Warn about or prevent VLA use in C++

ARM and GNU compilers currently are in a mode where they will accept VLAs
in C++ as an extension. IAR does not accept them in C++.

Avoid potential portability surprises by making GCC warn, and
deactivating the extension in ArmCC.
pull/1985/head
Kevin Bracey 2016-06-23 09:54:30 +03:00
parent 80a03e1787
commit b74546c731
2 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,7 @@ class ARM(mbedToolchain):
"--brief_diagnostics", "--restrict", "--multibyte_chars", "-I \""+ARM_INC+"\""],
'asm': [],
'c': ["--md", "--no_depend_system_headers", "--c99", "-D__ASSERT_MSG"],
'cxx': ["--cpp", "--no_rtti"],
'cxx': ["--cpp", "--no_rtti", "--no_vla"],
'ld': [],
}

View File

@ -38,7 +38,7 @@ class GCC(mbedToolchain):
],
'asm': ["-x", "assembler-with-cpp"],
'c': ["-std=gnu99"],
'cxx': ["-std=gnu++98", "-fno-rtti"],
'cxx': ["-std=gnu++98", "-fno-rtti", "-Wvla"],
'ld': ["-Wl,--gc-sections", "-Wl,--wrap,main",
"-Wl,--wrap,_malloc_r", "-Wl,--wrap,_free_r", "-Wl,--wrap,_realloc_r"],
}