[PATCH] Please define thread_info as struct thread_info (and other stuff)
Simon Marchi
simark@simark.ca
Sun Dec 16 04:31:00 GMT 2018
On 2018-12-15 6:01 p.m., Svante Signell wrote:
> A typical error output:
> CXX target.o
> /home/srs/DEBs/gdb/gdb-8.2/gdb/target.c: In function âint
> dispose_inferior(inferior*, void*)â:
> /home/srs/DEBs/gdb/gdb-8.2/gdb/target.c:2028:16: error: âthreadâ was not
> declared
> in this scope
> thread_info *thread = any_thread_of_inferior (inf);
> ^~~~~~
> /home/srs/DEBs/gdb/gdb-8.2/gdb/target.c:2028:16: note: suggested alternative:
> âmyreadâ
> thread_info *thread = any_thread_of_inferior (inf);
> ^~~~~~
> myread
>
> Sorry, but the compiler directive is hidden from the output (by libtool??).
You can do "make V=1" to show the compiler invocation (same as if we would use automake).
>
> ii gcc 4:8.2.0-2 hurd-i386 GNU C compiler
> ii g++ 4:8.2.0-2 hurd-i386 GNU C++ compiler
>
> I would be very happy if you could be consistent in the coding: Either use
> struct thread_info everywhere or not.
Well, we started with the "struct" keyword everywhere (because C), and many people get
rid of it in the parts of the code they touch (though not everyone, and I don't turn
down a patch just for this). We also won't make a big change to remove the use of
"struct" throughout, as it would be a lot of work for nothing, it would create
unnecessary conflicts for people who maintain external patches and it would pollute
the history when git-blaming.
What you compiler is doing is very strange, as Tom mentioned the use of the "struct"
or "class" keyword when declaring a variable in C++ is optional. What does your
compiler say when compiling the following code (g++ -c foo.cpp)?
struct Foo
{
int a;
};
void func()
{
Foo f2;
}
Simon
More information about the Gdb-patches
mailing list