Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: gdb-patches@sourceware.org,
	Thomas Schwinge <thomas@codesourcery.com>,
	thomas@schwinge.name, bug-hurd@gnu.org
Subject: Re: [PATCH] hurd: Add shared mig declarations
Date: Sun, 31 May 2020 22:05:45 -0400	[thread overview]
Message-ID: <5bbcce80-bd49-9903-0825-2235c73880e3@simark.ca> (raw)
In-Reply-To: <20200531072032.hfegxapkqv3a3hrb@function>

On 2020-05-31 3:20 a.m., Samuel Thibault wrote:
> Simon Marchi, le sam. 30 mai 2020 21:51:35 -0400, a ecrit:
>> On 2020-05-30 2:23 p.m., Samuel Thibault wrote:
>>> Fixes
>>>
>>> exc_request_S.c:177:24: error: no previous declaration for ‘exc_server’ [-Werror=missing-declarations]
>>>   177 | mig_external boolean_t exc_server
>>>
>>> gdb/ChangeLog:
>>>
>>> 	* config/i386/i386gnu.mn [%_S.o %_U.o] (COMPILE.post): Add
>>> 	"-include gnu-nat-mig.h".
>>> 	* gnu-nat-mig.h: New file.
>>> 	* gnu-nat.c: Include "gnu-nat-mig.h".
>>> 	(exc_server, msg_reply_server, notify_server,
>>> 	process_reply_server): Remove declarations.
>>
>> It took me a while to understand the underlying problem.  My understanding is that
>> gnu-nat.c calls this function exc_server, that is defined in the generated file.  The
>> generated file does not provide a header with declarations, so gnu-nat.c had its own
>> local declaration.  Since we now use the -Wmissing-declarations warning flag, and the
>> definition in the generated exc_request_S.c didn't see a corresponding declaration,
>> it caused that build failure.  Is that correct?  If so, please add that explanation
>> or equivalent to the commit log.
> 
> I have now added
> 
> “
> We are using -Werror=missing-declarations, and the _S.h files generated
> by mig do not currently include a declaration for the server routine.
> gnu-nat.c used to have its own external declarations, but better just
> share them between gnu-nat.c and the _S.c files.
> ”

Thanks, that sounds good.  And this way, I suppose that if for some reason the prototypes
don't match, we'll get a compilation error (which is a good thing).

>> My question now is: that MIG tool appears to generate both a header (%_S.h) and source
>> file (%_S.c) from defs files.  What is this header file used for, if it doesn't contain
>> the declaration for the functions in the source file?
> 
> Mig does include declarations for the functions of the .c files, but
> not for the server routine, I don't know why that was never implemented
> there (this hasn't been touched since the VCS initial import).

Ok.

Simon



  reply	other threads:[~2020-06-01  2:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-30 18:23 Samuel Thibault
2020-05-30 18:30 ` Samuel Thibault
2020-05-30 19:51 ` Pedro Alves
2020-05-30 20:28   ` Samuel Thibault
2020-05-31  1:51 ` Simon Marchi
2020-05-31  7:20   ` Samuel Thibault
2020-06-01  2:05     ` Simon Marchi [this message]
2020-06-01  7:54       ` Samuel Thibault
2020-06-01 16:33 ` Christian Biesinger

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=5bbcce80-bd49-9903-0825-2235c73880e3@simark.ca \
    --to=simark@simark.ca \
    --cc=bug-hurd@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=thomas@codesourcery.com \
    --cc=thomas@schwinge.name \
    /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