bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17072: bug#17381: _GL_ATTRIBUTE_PURE in dfa.h


From: Paul Eggert
Subject: bug#17072: bug#17381: _GL_ATTRIBUTE_PURE in dfa.h
Date: Thu, 01 May 2014 23:11:06 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 05/01/2014 11:29 AM, Aharon Robbins wrote:
custom.h is for system customization to override things that Autoconf can't figure out or gets wrong

OK, it's easy to have something else include mbsupport.h instead. config.h, say. The attached patch does that. It doesn't really matter what includes it, so long as it's done before dfa.c and dfa.h start using the multibyte functions.

Requiring gnulib in that header makes it less attractive to other projects that might want to use dfa as a black box. Are there such? I don't know. (I thought I'd heard something about gettext using dfa but I am unsure if that is true.)

gettext uses gnulib, so that's not an issue.

Does the GL_PURE stuff have to be on every declaration? Or can it just be on the body?

It should be on the declaration for external functions, so that the function's caller knows to optimize it.

What does it even mean

It means the function has no effects except the return value and that the return value depends only on the parameters and/or global variables.

Does whatever optimization it enables *really* make a big difference, or is it just a micro-optimization?

We put it in because GCC nowadays complains if we leave it out, if we configure with --enable-gcc-warnings. The optimization seems to be a win in general and (more important) an aid for humans reading the code, so we typically just add the pure attribute and move on.

Yes, I know. I am unsure if your patch, which totally eliminates the ability to compile gawk on systems without multibyte support

It's not supposed to do that. It's supposed to work on those hosts, by supplying substitutes for wchar_t, wctype_t, etc. Hmm, are you worried about hosts that don't even have wchar.h and wctype.h? If so, that can be worked around reasonably easily; please see attached patch.

I just looked at the patch again. It really doesn't do the trick; there are lots of places where MBS_SUPPORT is checked in the gawk code and pulling mbsupport.h out of awk.h is likely to break things

No, it should still work. With the revised patch, config.h includes mbsupport.h, so MBS_SUPPORT will be defined appropriately for gawk code and gawk's other MBS_SUPPORT usages will continue to work as before.

I'll CC: this to Bug#17157 and Bug#17072 as it's following up to the last messages in both those threads, too.

Attachment: 0001-awk-simplify-dfa.c-by-having-it-not-include-mbsuppor.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]