This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Please define thread_info as struct thread_info (and other stuff)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]