unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master c8bde5b0a3: Fix two no-X compilation warnings
       [not found] ` <20220322201440.6B4ABC01680@vcs2.savannah.gnu.org>
@ 2022-03-23  0:55   ` Po Lu
  2022-03-23 11:17     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Po Lu @ 2022-03-23  0:55 UTC (permalink / raw)
  To: emacs-devel; +Cc: Lars Ingebrigtsen

Lars Ingebrigtsen <larsi@gnus.org> writes:

> -  (or (stringp x-resource-name)
> +  (when (boundp 'x-resource-name)
> +    (unless (stringp x-resource-name)
>        (let (i)
>  	(setq x-resource-name (copy-sequence invocation-name))
>  
>  	;; Change any . or * characters in x-resource-name to hyphens,
>  	;; so as not to choke when we use it in X resource queries.
>  	(while (setq i (string-match "[.*]" x-resource-name))
> -	  (aset x-resource-name i ?-))))
> +	  (aset x-resource-name i ?-)))))
>  
>    ;; Setup the default fontset.
>    (create-default-fontset)

I thought the right thing to do in this particular situation was to add
a defvar form that read something like this:

(defvar x-resource-name)

Thanks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master c8bde5b0a3: Fix two no-X compilation warnings
  2022-03-23  0:55   ` master c8bde5b0a3: Fix two no-X compilation warnings Po Lu
@ 2022-03-23 11:17     ` Lars Ingebrigtsen
  2022-03-23 11:48       ` Po Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-03-23 11:17 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

Po Lu <luangruo@yahoo.com> writes:

> I thought the right thing to do in this particular situation was to add
> a defvar form that read something like this:
>
> (defvar x-resource-name)

That would hide the compilation warning, too -- but if the code actually
ends up being called, it'll bug out.  (That's not very likely in this
case, though.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master c8bde5b0a3: Fix two no-X compilation warnings
  2022-03-23 11:17     ` Lars Ingebrigtsen
@ 2022-03-23 11:48       ` Po Lu
  2022-03-23 11:50         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Po Lu @ 2022-03-23 11:48 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Po Lu <luangruo@yahoo.com> writes:
>
>> I thought the right thing to do in this particular situation was to add
>> a defvar form that read something like this:
>>
>> (defvar x-resource-name)
>
> That would hide the compilation warning, too -- but if the code actually
> ends up being called, it'll bug out.  (That's not very likely in this
> case, though.)

Hmm, thanks for explaining.  But I thought defvar didn't do anything
with variables that are already defined, such as in C code.

Thanks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master c8bde5b0a3: Fix two no-X compilation warnings
  2022-03-23 11:48       ` Po Lu
@ 2022-03-23 11:50         ` Lars Ingebrigtsen
  2022-03-23 12:57           ` Po Lu
  2022-03-23 13:09           ` Andreas Schwab
  0 siblings, 2 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-03-23 11:50 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

Po Lu <luangruo@yahoo.com> writes:

> Hmm, thanks for explaining.  But I thought defvar didn't do anything
> with variables that are already defined, such as in C code.

They don't.  But if you call the code that use those variables (that
aren't defined), the code will error out.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master c8bde5b0a3: Fix two no-X compilation warnings
  2022-03-23 11:50         ` Lars Ingebrigtsen
@ 2022-03-23 12:57           ` Po Lu
  2022-03-23 13:09           ` Andreas Schwab
  1 sibling, 0 replies; 6+ messages in thread
From: Po Lu @ 2022-03-23 12:57 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

> They don't.  But if you call the code that use those variables (that
> aren't defined), the code will error out.

That code in particular can never be called outside PGTK, I think, so I
wouldn't be worried about that.

But thanks for explaining.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master c8bde5b0a3: Fix two no-X compilation warnings
  2022-03-23 11:50         ` Lars Ingebrigtsen
  2022-03-23 12:57           ` Po Lu
@ 2022-03-23 13:09           ` Andreas Schwab
  1 sibling, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2022-03-23 13:09 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Po Lu, emacs-devel

On Mär 23 2022, Lars Ingebrigtsen wrote:

> They don't.  But if you call the code that use those variables (that
> aren't defined), the code will error out.

But term/pgtk-win is only ever loaded when x-resource-name is defined.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-23 13:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <164798008014.25625.1667266381969929314@vcs2.savannah.gnu.org>
     [not found] ` <20220322201440.6B4ABC01680@vcs2.savannah.gnu.org>
2022-03-23  0:55   ` master c8bde5b0a3: Fix two no-X compilation warnings Po Lu
2022-03-23 11:17     ` Lars Ingebrigtsen
2022-03-23 11:48       ` Po Lu
2022-03-23 11:50         ` Lars Ingebrigtsen
2022-03-23 12:57           ` Po Lu
2022-03-23 13:09           ` Andreas Schwab

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).