all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* What’s the deal with #if _LIBC and other non-Emacs code?
@ 2016-07-25 22:58 Michal Nazarewicz
  2016-07-26  2:34 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Michal Nazarewicz @ 2016-07-25 22:58 UTC (permalink / raw
  To: emacs-devel

Dear Emacs developers!

I’ve noticed quite some code in regex.c and regex.h which isn’t used by
Emacs or any executable distributed with Emacs.  Most notably, there are
blocks of code guarded with ‘#ifdef _LIBC’ macro and support for
alternative syntax which is never actually used.

To me this all looks like it could be safely removed simplifying and
shortening the code.

I would be happy to prepare patches doing just that, but first I’d like
to make sure that there’s nothing I’m missing.

-- 
Best regards
ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ
«If at first you don’t succeed, give up skydiving»



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

* Re: What’s the deal with #if _LIBC and other non-Emacs code?
  2016-07-25 22:58 What’s the deal with #if _LIBC and other non-Emacs code? Michal Nazarewicz
@ 2016-07-26  2:34 ` Eli Zaretskii
  2016-07-26  2:42   ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2016-07-26  2:34 UTC (permalink / raw
  To: Michal Nazarewicz; +Cc: emacs-devel

> From: Michal Nazarewicz <mina86@mina86.com>
> Date: Tue, 26 Jul 2016 00:58:06 +0200
> 
> I’ve noticed quite some code in regex.c and regex.h which isn’t used by
> Emacs or any executable distributed with Emacs.  Most notably, there are
> blocks of code guarded with ‘#ifdef _LIBC’ macro and support for
> alternative syntax which is never actually used.
> 
> To me this all looks like it could be safely removed simplifying and
> shortening the code.
> 
> I would be happy to prepare patches doing just that, but first I’d like
> to make sure that there’s nothing I’m missing.

This code is maintained by glibc, where those parts are used.
Although our version diverged quite a lot from the one in glibc, we
still have plans to merge them at some point.  So I think we shouldn't
remove those parts.

Thanks.



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

* Re: What’s the deal with #if _LIBC and other non-Emacs code?
  2016-07-26  2:34 ` Eli Zaretskii
@ 2016-07-26  2:42   ` Stefan Monnier
  2016-07-26  6:50     ` Paul Eggert
  2016-07-26 14:51     ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2016-07-26  2:42 UTC (permalink / raw
  To: emacs-devel

> This code is maintained by glibc, where those parts are used.
> Although our version diverged quite a lot from the one in glibc, we
> still have plans to merge them at some point.  So I think we shouldn't
> remove those parts.

AFAIK, this code used to be in some version of glibc, but glibc has
moved to a completely different regexp implementation many years ago.
IIRC gnulib was the last non-Emacs package which shared this code, and
AFAIK gnulib also dropped this (not sure if it replaced it with
something else or what, tho).

So, my understanding is that this code is now 100% ours with no hope to
sync it with anyone else.


        Stefan




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

* Re: What’s the deal with #if _LIBC and other non-Emacs code?
  2016-07-26  2:42   ` Stefan Monnier
@ 2016-07-26  6:50     ` Paul Eggert
  2016-07-26 14:51     ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Paul Eggert @ 2016-07-26  6:50 UTC (permalink / raw
  To: Stefan Monnier, emacs-devel

On 07/26/2016 04:42 AM, Stefan Monnier wrote:
> AFAIK, this code used to be in some version of glibc, but glibc has
> moved to a completely different regexp implementation many years ago.
> IIRC gnulib was the last non-Emacs package which shared this code, and
> AFAIK gnulib also dropped this (not sure if it replaced it with
> something else or what, tho).

Gnulib regularly merges as many glibc changes as it can, and is now 
using essentially the same implementation that glibc does. It should be 
fairly easy to merge the gnulib changes back into glibc, if someone 
wants to volunteer to do that.

> So, my understanding is that this code is now 100% ours with no hope to
> sync it with anyone else.

The Emacs regex code could also be merged into glibc, though that would 
be a somewhat bigger project than merging gnulib into glibc, as there 
has been little or no attempt to keep the Emacs copy in sync with glibc.




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

* Re: What’s the deal with #if _LIBC and other non-Emacs code?
  2016-07-26  2:42   ` Stefan Monnier
  2016-07-26  6:50     ` Paul Eggert
@ 2016-07-26 14:51     ` Eli Zaretskii
  2016-07-26 15:33       ` Stefan Monnier
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2016-07-26 14:51 UTC (permalink / raw
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Mon, 25 Jul 2016 22:42:55 -0400
> 
> > This code is maintained by glibc, where those parts are used.
> > Although our version diverged quite a lot from the one in glibc, we
> > still have plans to merge them at some point.  So I think we shouldn't
> > remove those parts.
> 
> AFAIK, this code used to be in some version of glibc, but glibc has
> moved to a completely different regexp implementation many years ago.

Sorry, I meant gnulib.

> IIRC gnulib was the last non-Emacs package which shared this code, and
> AFAIK gnulib also dropped this (not sure if it replaced it with
> something else or what, tho).
> 
> So, my understanding is that this code is now 100% ours with no hope to
> sync it with anyone else.

I wasn't aware we made such a decision.  AFAIR, last time this was
discussed the desire to merge with gnulib was still there, although
not the resources.



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

* Re: What’s the deal with #if _LIBC and other non-Emacs code?
  2016-07-26 14:51     ` Eli Zaretskii
@ 2016-07-26 15:33       ` Stefan Monnier
  2016-07-26 15:40         ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2016-07-26 15:33 UTC (permalink / raw
  To: emacs-devel

> I wasn't aware we made such a decision.

That's not a decision we took.  The change was on gnulib's side
(apparently they switched to glibc's regexp implementation, which makes
a lot of sense, actually).


        Stefan




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

* Re: What’s the deal with #if _LIBC and other non-Emacs code?
  2016-07-26 15:33       ` Stefan Monnier
@ 2016-07-26 15:40         ` Eli Zaretskii
  2016-07-26 16:06           ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2016-07-26 15:40 UTC (permalink / raw
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Tue, 26 Jul 2016 11:33:47 -0400
> 
> > I wasn't aware we made such a decision.
> 
> That's not a decision we took.  The change was on gnulib's side
> (apparently they switched to glibc's regexp implementation, which makes
> a lot of sense, actually).

I meant the decision to abandon hope of merging.



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

* Re: What’s the deal with #if _LIBC and other non-Emacs code?
  2016-07-26 15:40         ` Eli Zaretskii
@ 2016-07-26 16:06           ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2016-07-26 16:06 UTC (permalink / raw
  To: emacs-devel

>> > I wasn't aware we made such a decision.
>> That's not a decision we took.  The change was on gnulib's side
>> (apparently they switched to glibc's regexp implementation, which makes
>> a lot of sense, actually).
> I meant the decision to abandon hope of merging.

AFAIK the code used in gnulib and glibc is very completely different
from Emacs's, so "merging" back into their code is not really
applicable.  We could try and take their code, add to it the features we
need, and then submit those changes back to them, tho.


        Stefan


PS: I'm not sure exactly what would be missing, but I expect that \s and
\c together with the ability to match on a pair of char* would be the
first candidates.

PPS: I think the most serious problem with our regexp code is its
occasional exponential worst case.  I think changing to another
implementation would make a lot of sense, but only if that other
implementation can use a "Thompson's NFA" style implementation to avoid
those pathological cases.




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

end of thread, other threads:[~2016-07-26 16:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-25 22:58 What’s the deal with #if _LIBC and other non-Emacs code? Michal Nazarewicz
2016-07-26  2:34 ` Eli Zaretskii
2016-07-26  2:42   ` Stefan Monnier
2016-07-26  6:50     ` Paul Eggert
2016-07-26 14:51     ` Eli Zaretskii
2016-07-26 15:33       ` Stefan Monnier
2016-07-26 15:40         ` Eli Zaretskii
2016-07-26 16:06           ` Stefan Monnier

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.