public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Svante Signell <svante.signell@gmail.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	 Tom Tromey <tom@tromey.com>,  Simon Marchi <simark@simark.ca>,
	 gdb-patches@sourceware.org
Subject: Re: [PATCH] Please define thread_info as struct thread_info (and other stuff)
Date: Sun, 16 Dec 2018 23:10:00 -0000	[thread overview]
Message-ID: <87d0q13w6b.fsf@tromey.com> (raw)
In-Reply-To: <000db1d81a0c415190b6648222ed29db7f927df9.camel@gmail.com>	(Svante Signell's message of "Sun, 16 Dec 2018 20:08:30 +0100")

>>>>> "Svante" == Svante Signell <svante.signell@gmail.com> writes:

>> Try adding a forward declaration of struct thead_info.  Note that
>> config/i386/nm-i386gnu.h includes "regcache.h", making it unique among
>> the nm.h files.

Svante> From what I've leraned forward declarations is bad coding, an should be avoided
Svante> as much as possible. Right or wrong?

Opinions vary -- I think the Google style has a rule against it? -- but
gdb generally does not avoid it.

Svante> Furthermore, not defining thread_info as struct everywhere is in my opinion very
Svante> lazy coding.

I disagree here, C++ provides the typedef, there's nothing really wrong
with using it.

Svante> Another issue is to compile C-code (and C++-code) in *.c files.
Svante> Please rename these to *.cpp (and eventually the header files to *.hpp)! As it
Svante> is now it is very confusing.

I think this was discussed When we made this switch, and the conclusion
was that a mass rename would be worse.

Svante> Finally, I've found the problem (but no workaround yet): thread_info is an RPC
Svante> on GNU/Hurs, and including mach.h in gdb/config/i386/nm-i386gnu.h:#include
Svante> <mach.h> further includes <mach/mach_interface.h> which has the conflicting name
Svante> of that RPC:
Svante> kern_return_t thread_info
Svante> (

Typical answers for this kind of thing are either to segregate the use
of the system header somehow, or maybe namespacing or some other kind of
renaming.  I haven't looked into the details much in this case I'm
afraid.

Tom

  reply	other threads:[~2018-12-16 23:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-15 19:36 Svante Signell
2018-12-15 22:48 ` Tom Tromey
2018-12-15 23:01   ` Svante Signell
2018-12-16  4:31     ` Simon Marchi
2018-12-16  5:14       ` Svante Signell
2018-12-16  6:02         ` Simon Marchi
2018-12-16 16:22         ` Tom Tromey
2018-12-16  9:20 ` Andreas Schwab
2018-12-16 19:08   ` Svante Signell
2018-12-16 23:10     ` Tom Tromey [this message]
2018-12-17 20:51       ` Svante Signell
2018-12-17 21:41         ` John Baldwin
2019-02-14 15:16           ` Thomas Schwinge
2018-12-20 13:31         ` Svante Signell
2018-12-20 22:34           ` Tom Tromey
2018-12-20 23:26             ` Simon Marchi
2018-12-21 18:17             ` John Baldwin
2018-12-24 21:51             ` Tom Tromey
2019-01-12 18:37               ` Svante Signell
2019-01-12 20:50                 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d0q13w6b.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=schwab@linux-m68k.org \
    --cc=simark@simark.ca \
    --cc=svante.signell@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).