GNU bug report logs -
#51484
[PATCH] Move runtime check for recent giflib to compile time
Previous Next
Reported by: Stefan Kangas <stefan <at> marxist.se>
Date: Fri, 29 Oct 2021 14:44:02 UTC
Severity: wishlist
Tags: patch
Done: Stefan Kangas <stefan <at> marxist.se>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51484 in the body.
You can then email your comments to 51484 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#51484
; Package
emacs
.
(Fri, 29 Oct 2021 14:44:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Stefan Kangas <stefan <at> marxist.se>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 29 Oct 2021 14:44:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Severity: wishlist
I'm looking into some bugs in how we handle gifs, and I see that we
check for GIFLIB_MAJOR at runtime. Is there any reason not to do it at
compile-time as in the attached patch?
I expect that GCC is smart enough to see that "5 < 4" is always false
and optimize this all away, and probably also won't include unused
static variables, so maybe this doesn't matter. But I think it's nice
to be a bit more explicit, and I guess it can't hurt to see warnings if
anyone tries using interlace_start and interlace_increment outside of
their intended use.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#51484
; Package
emacs
.
(Fri, 29 Oct 2021 16:03:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 51484 <at> debbugs.gnu.org (full text, mbox):
Stefan Kangas <stefan <at> marxist.se> writes:
> I'm looking into some bugs in how we handle gifs, and I see that we
> check for GIFLIB_MAJOR at runtime. Is there any reason not to do it at
> compile-time as in the attached patch?
-ENOPATCH
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#51484
; Package
emacs
.
(Fri, 29 Oct 2021 16:11:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 51484 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Fri, 29 Oct 2021 07:42:56 -0700
>
> I'm looking into some bugs in how we handle gifs, and I see that we
> check for GIFLIB_MAJOR at runtime.
Only once, right?
> Is there any reason not to do it at compile-time as in the attached
> patch?
(What patch?)
The compiler converts that into a run-time constant anyway. The
reason for using such "run-time" testing is usually to have a more
readable code, since #ifdef's make the code harder to read. There are
no downsides, since the test is compiled away.
> I expect that GCC is smart enough to see that "5 < 4" is always false
> and optimize this all away, and probably also won't include unused
> static variables, so maybe this doesn't matter. But I think it's nice
> to be a bit more explicit, and I guess it can't hurt to see warnings if
> anyone tries using interlace_start and interlace_increment outside of
> their intended use.
I don't think I understand what scenario you have in mind where having
an #ifdef would be better. Please elaborate.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#51484
; Package
emacs
.
(Fri, 29 Oct 2021 16:31:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 51484 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:
> (What patch?)
Oops, let's try that again.
> The compiler converts that into a run-time constant anyway. The
> reason for using such "run-time" testing is usually to have a more
> readable code, since #ifdef's make the code harder to read. There are
> no downsides, since the test is compiled away.
Right, hence my asking what you all think of the patch. Which is now
hopefully also attached.
[0001-Move-runtime-check-for-recent-giflib-to-compile-time.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#51484
; Package
emacs
.
(Fri, 29 Oct 2021 17:59:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 51484 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Fri, 29 Oct 2021 09:30:40 -0700
> Cc: 51484 <at> debbugs.gnu.org
>
> > The compiler converts that into a run-time constant anyway. The
> > reason for using such "run-time" testing is usually to have a more
> > readable code, since #ifdef's make the code harder to read. There are
> > no downsides, since the test is compiled away.
>
> Right, hence my asking what you all think of the patch. Which is now
> hopefully also attached.
I generally prefer to avoid #ifdef's, so I think the change you
propose is not for the better. We have similar code elsewhere in
Emacs, and there's nothing wrong with it.
Reply sent
to
Stefan Kangas <stefan <at> marxist.se>
:
You have taken responsibility.
(Fri, 29 Oct 2021 18:16:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Stefan Kangas <stefan <at> marxist.se>
:
bug acknowledged by developer.
(Fri, 29 Oct 2021 18:16:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 51484-done <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> I generally prefer to avoid #ifdef's, so I think the change you
> propose is not for the better. We have similar code elsewhere in
> Emacs, and there's nothing wrong with it.
OK, thanks for taking a look. I appreciate you taking the time to
explain your thinking as well, it is most helpful.
I'm closing this bug report.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 27 Nov 2021 12:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 207 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.