standard_testfile .c
-if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} {
+if {[build_executable "failed to prepare" $testfile $srcfile \
+ {debug additional_flags=-std=c99}] == -1} {
return
}
ElfW (Addr) sym_new_addr = 0;
/* Find `func_name` in symbol_table and return its address. */
-
- for (int i = 0; i < ehdr->e_shnum; ++i)
+ int i;
+ for (i = 0; i < ehdr->e_shnum; ++i)
{
if (shdr[i].sh_type == SHT_SYMTAB)
{
char *const strtab
= (char *) (addr + shdr[shdr[i].sh_link].sh_offset);
- for (ElfW (Sym) *p = symtab; p < symtab_end; ++p)
+ ElfW (Sym) *p;
+ for (p = symtab; p < symtab_end; ++p)
{
const char *s = strtab + p->st_name;
if (strcmp (s, sym_name) == 0)
}
foreach_with_prefix threaded {0 1} {
- set options [list debug additional_flags=-DWITH_THREADS=$threaded]
+ set options [list debug additional_flags=-DWITH_THREADS=$threaded \
+ additional_flags=-std=gnu99]
if { $threaded } {
set binfile $binfile_threads
lappend options pthreads
standard_testfile .c
if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile \
- executable debug] != "" } {
+ executable {debug additional_flags=-std=gnu99}] != "" } {
return -1
}
proc build_inferior {exefile lang} {
global srcdir subdir srcfile testfile hex
- if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${exefile}" executable "debug $lang"] != "" } {
+ set flags [list debug $lang]
+ if { $lang == "c" } {
+ lappend flags additional_flags=-std=c99
+ }
+
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${exefile}" \
+ executable $flags] != "" } {
untested "failed to compile in $lang mode"
return -1
}
}
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
- executable {debug}] != "" } {
+ executable {debug additional_flags=-std=gnu99}] != "" } {
return -1
}
standard_testfile
-if { [build_executable "failed to prepare" ${testfile} ${srcfile} {debug pthreads}] } {
+if { [build_executable "failed to prepare" ${testfile} ${srcfile} \
+ {debug pthreads additional_flags=-std=c99}] } {
return
}