Commit Graph

17713 Commits

Author SHA1 Message Date
Corinna Vinschen f4fb06ce17 Add/change a few #ifdef comments in locale code for clearness
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-23 12:43:40 +02:00
Corinna Vinschen 3eace743b2 Remove erroneous POSIX guards for reentrant locale functions
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-23 12:39:42 +02:00
Corinna Vinschen 2fb5e3dfb2 Reference __global_locale only via __get_global_locale.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-23 12:38:28 +02:00
David Wohlferd 113abc27a6 Avoid truncating from long double to double in sinhl().
This routine makes a call to fabs instead of fabsl(), causing truncation.

Clang complains (warning: absolute value function 'fabs' given an argument of type 'long double' but has parameter of type 'double' which may cause truncation of value).

Signed-off-by: David Wohlferd <dw@LimeGreenSocks.com>
2016-08-22 14:18:39 +02:00
Ray Donnelly 96fc528397 sqrt: Fix NaN propagation for IEEE Std 754-2008
The R language has some hacks specifically for mingw-w64 that
were caused by our handling of NaNs in sqrt(x). R uses a
special valued NaN to mean 'Not Available' and expects it to
be retained through various calculations. Our sqrt(x) doesn't
do this, instead it normalises such a NaN (retaining sign).

From:

http://wwwf.imperial.ac.uk/~drmii/M3SC_2016/IEEE_2008_4610935.pdf

"6.2.3 NaN propagation

An operation that propagates a NaN operand to its result and
has a single NaN as an input should produce a NaN with the
payload of the input NaN if representable in the destination
format."

There might even be a slight speed-up from this too.

Thanks to Duncan Murdoch for finding the reference.
2016-08-22 14:17:58 +02:00
Corinna Vinschen 5085ce2106 Remove extern declaration of __locale_cjk_lang in string/local.h
Now that __locale_cjk_lang is an inline function in setlocale.h and
setlocale.h is included, the declaration doesn't make sense.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-21 12:14:32 +02:00
Corinna Vinschen 0df76cbd63 Document nl_langinfo_l and separate POSIX from GNU extensions in release message
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-20 17:24:16 +02:00
Corinna Vinschen 216054fa77 Implement missing POSIX function nl_langinfo_l
Change nl_langinfo to nl_langinfo_l using locale given as argument.
Remove outdated TRANSITION_PERIOD_HACK.  The codeset is stored in
the locale for quite some time now.  For !MB_CAPABLE targets, just
return "US_ASCII" as codeset.

Implement nl_langinfo by calling nl_langinfo_l.  Export nl_langinfo_l
from Cygwin DLL and bump minor API version number.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-20 17:22:41 +02:00
Corinna Vinschen 7630e38462 Introduce __current_locale_charset/__locale_charset
The former __locale_charset always fetched the current locale's charset.
We need the per-locale charset, too, in future. Rename __locale_charset
to __current_locale_charset and change __locale_charset to take a
locale_t as parameter.  Accommodate througout.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-20 17:14:56 +02:00
Corinna Vinschen 06ac671811 Only define __getreent inline function when building newlib or Cygwin
Commit 6f3943b erroneously removed the `#ifdef _COMPILING_NEWLIB'
guarding the __getreent inline function.  This patch ignored the
fact that config.h is included when building applications, and the
code in question requires internal, auto-generated headers to be
available which are not exposed to user-space.

Reinstantiate defined(_COMPILING_NEWLIB) test and alternatively
check for defined (__INSIDE_CYGWIN__), otherwise we'd have to
reinstantiate the __getreent macro in cygtls.h which is really
confusing.

While testing it turned out that a low number of source codes inside
Cygwin won't see the inline __getreent due to a missing __INSIDE_CYGWIN__
definition.  For malloc.cc this was actually deliberate to get different
definitions from including cygmalloc.h.  Change this by defining
__INSIDE_CYGWIN__ in malloc.cc but changing the test in cygmalloc.h
to test for defined(DLMALLOC_VERSION).  This might need a change if we
ever get around to replace dlmalloc with a newer, more threading-aware
malloc implementation.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-20 17:14:55 +02:00
Corinna Vinschen 5e9b414e1c Add release message for commit eb61113
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-19 17:25:31 +02:00
Corinna Vinschen 3a2f654379 Add release message for commit a871644
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-19 16:54:56 +02:00
Corinna Vinschen a8716448ce Simplify "Windows-standard-like" permissions
Commit 97d0449 left a bit to be desired.  First, the fact that any
new-style ACL couldn't be "standard ACL" anymore was very much over
the top.  On one hand Admins and SYSTEM ACEs are not supposed to be
masked, but on the other hand we *must* create the CLASS_OBJ
because otherwise we don't have information about masking the
execute perms for both groups.  The ACL would also fail aclcheck.

And while get_posix_access now returns the "is standard acl" flag,
it hasn't been utilized by set_created_file_access.  Rather,
set_created_file_access has simply continued to check for
nentries > MIN_ACL_ENTRIES, which led to all kinds of weird group
and CLASS_OBJ perms.  The new code now always manipulates CLASS_OBJ
perms if a CLASS_OBJ is present, and it always manipulates group perms
if the ACL has been marked as "standard" ACL.

Another problem (not related to commit 97d0449) is the order
get_posix_access adds missing perms.  CLASS_OBJ perms are computed
*before* missing GROUP_OBJ perms have been added.  Thus the CLASS_OBJ
perms could be too tight and led to additional, buggy DENY ACEs.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-19 16:50:15 +02:00
Corinna Vinschen 3e8f833df0 Fix outdated S_JUSTCREATED comment
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-19 16:27:07 +02:00
Thomas Preud'homme 65277df72d Fix html build 2016-08-19 11:59:37 +02:00
Thomas Preudhomme 3ce88693f5 Fix html build with makeinfo 5.2
HTML build fails with makeinfo 5.2 with the following error:

libgloss/doc/porting.texi:73: @menu seen before first @node
libgloss/doc/porting.texi:73: perhaps your @top node should be wrapped in
@ifnottex rather than @ifinfo?

Following the advice indeed solve the issue while still allowing pdf, dvi and
info builds to work.
2016-08-19 10:32:23 +02:00
Corinna Vinschen 6f3943bca1 Reinstantiate Cygwin function called `__getreent'
This partially reverts commit 10a30e7 as far as the Cygwin version of
the __getreent function is concerned.  Remove _COMPILING_NEWLIB guard
only allowing to use __getreent inline function when building newlib,
since we wan to use it in Cygwin as well.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Stefan Assmann <sassmann@redhat.com>
2016-08-18 15:24:42 +02:00
Corinna Vinschen 3bbc40af2a Revert "Fix __getreent function for Cygwin"
This reverts commit 4de8596.  It worked around a problem which was
actually introduced by patch 10a30e7 a few weeks ago.  Rather than
adding special code to the newlib version of __getreent, the followup
patch reinstantiates the original, Cygwin-only implementation of
__getreent.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Stefan Assmann <sassmann@redhat.com>
2016-08-18 15:24:18 +02:00
Corinna Vinschen eb61113daf Workaround AzureAD shortcomings
No real domain, no DC, no infos via NetUserGetInfo... nothing.  Just nothing.

Use fixed uid 0x1000 (4096) for AzureAD user and gid 0x1001 (4097) for
AzureAD group.  Note that this group is part of the user token, but it's
not the primary group.  The primary group SID is, unfortunately, the
user's SID.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-18 10:27:28 +02:00
Corinna Vinschen 4de8596b8e Fix __getreent function for Cygwin
So far the lib function __getreent always returned _impure_ptr.  On Cygwin
this is only correct after _impure_ptr got initialized.  The inline
function in include/cygwin/config.h always returns the right _reent ptr,
though.

After introducing per-thread locales, the __getreent function is called
prior to initialization of _impure_ptr (from dll_crt0_0) to access the
locale pointer, which leads to a crash.

Fix the __getreent lib function for Cygwin to return the correct _reent
pointer all the time.  Rename inline function to __inline_getreent
and introduce a macro __getreent calling the inline function.  Change
the lib function __getreent to call __inline_getreent on Cygwin.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-18 10:27:14 +02:00
Thomas Preudhomme 0e2e3c958c Fix pdf build failure wrt documentation of is*_l functions
make pdf on arm-none-eabi targets fails to build after the reorganization in
baf0c9fcb5 to fold is*_l documentation in their
is* counterpart. This is due two issues:

1) newlib/libc/ctype/ctype.tex still including the def file for the long versions
2) missing angle brackets in .c files for some of is*_l functions

This patch fixes the issues and allows make pdf to succeeds.
2016-08-17 20:58:21 +02:00
Corinna Vinschen 8443fcd625 Add release message for commit c02ac89
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-17 11:17:26 +02:00
Corinna Vinschen c02ac89f28 Add -i/--input option to locale(1)
The default UI language returned by GetUserDefaultUILanguage does not
necessarily reflect what the user really wants.  E. g., the system could
be en_US, but the desired language is en_CA, without having a CA langpack
installed.

Changing the settings under "Languages" and changing the keyboard layout
is only affecting the so-called  "Input language", while what's returned
by GetUserDefaultUILanguage is the "Display language".  Changing the
latter requires installing MUI langpacks.

Thus, we introduce a way to fetch the "Input language" using the -i or
--input option.

Also clean up documentation of locale(1).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-17 10:58:04 +02:00
Corinna Vinschen b0d341442c Constify __locale_ctype_ptr and __locale_ctype_ptr_l
Remove _MB_CAPABLE-only _CONST in ctype.h

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-17 09:40:28 +02:00
Corinna Vinschen 1c25a777b3 Actually return pointers in locale categroy accessor functions
Commit 6e7ce50 was broken.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-16 16:23:51 +02:00
Corinna Vinschen 625a8a3f62 Always fall back to __ctype_ptr__ in isXXX_l functions.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-16 16:22:12 +02:00
Corinna Vinschen 042263cd83 Avoid "implicit declaration of function ‘strtold_l’" in wcstold.c
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-16 16:21:19 +02:00
Corinna Vinschen 1ec81984d8 Use era_info_t and alt_digits_t on _WANT_C99_TIME_FORMATS targets only
Using era_info_t and alt_digits_t indiscriminately in strftime and
strftime_l breaks targets not wanting C99 time formats.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-16 15:26:01 +02:00
Corinna Vinschen 6e7ce50e04 Expose locale category accessor functions to non-__HAVE_LOCALE_INFO__ targets.
These functions are used from, e.g., nl_langinfo or strftime, so
we need them for all targets.  Just return "C" locale category for
non-__HAVE_LOCALE_INFO__ targets.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-16 15:24:26 +02:00
Corinna Vinschen 7ef90f7f9d __localeconv_l: Always define locale variable lconv
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-16 13:54:32 +02:00
Corinna Vinschen 7964ad15c1 Don't use locale_t in internal header
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-16 13:51:46 +02:00
Corinna Vinschen a867598373 Rephrase release message
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-16 12:41:34 +02:00
Corinna Vinschen de09bb4d32 Fix typo in release message
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-16 11:22:26 +02:00
Corinna Vinschen 5dc306cf97 Add release text for Cygwin 2.6.0
Move release/2.5.3 to release/2.6.0.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 21:26:01 +02:00
Corinna Vinschen 238455adfa Implement strto[dflu]_l/wcsto[dflu]_l
Implement GNU extensions strtod_l, strtof_l, strtol_l, strtold_l, strtoll_l,
strtoul_l, strtoull_l, wcstod_l, wcstof_l, wcstol_l, wcstold_l, wcstoll_l,
wcstoul_l, wcstoull_l.

Export from Cygwin, fix posix.xml.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 17:35:21 +02:00
Corinna Vinschen 5ef60b7e6a Add documentation for duplocale, freelocale, newlocale, and uselocale.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 17:34:40 +02:00
Corinna Vinschen baf0c9fcb5 Fold documentation of is*_l funcs into documentation of non-l is* funcs
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 14:21:52 +02:00
Corinna Vinschen 5bdf8cfa49 setlocale/localeconv are *not* POSIX-1.2008
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:59 +02:00
Corinna Vinschen 1a5d08014b setlocale.h: Fix current locale handling for !__HAVE_LOCALE_INFO__ targets
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:59 +02:00
Corinna Vinschen beb721cf37 __loadlocale: Set missing val when evaluating CP874
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:59 +02:00
Corinna Vinschen 8f1378b19f Make sure alloca is called even when optimizing, fully init _REENT
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen d7281b92ab Fix multiple thinkos in newlocale
- Setting the categories strings in tmp_locale short-circuits
  __loadlocale.  Use a new_categories array instead, just as in
  _setlocale_r.

- If we have a base, copy over the *not* defined categories in
  category_mask in the first place.  Rearrange loop accordingly.

- Free base right in newlocale.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 659f4ca916 Fix _REENT_INIT initialization of _locale
Initializing a pointer to struct __locale_t to point to a string "C"
is not such a bright idea in the long run...

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 18f6750b95 Fix typo in isalnum_l doc
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen ac7f1d5e93 Get rid of LCID, reformat type definitions in setlocale.h
Definition of LCID results in build problems on 32 bit Cygwin

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 7156bf842e Add sys/_locale.h header and fix up headers
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 91ebe04042 Bump CygwinAPI minor.
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 765d2c0bac Implement strfmon_l
Use latest code from FreeBSD

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 542b970d4e Rename __get_locale_XXX to __get_XXX_locale to use unified naming scheme
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen fb4fb921c6 Move lconv into struct __locale_t and implement __localeconv_l
Based on FreeBSD, just don't export symbol yet, unless required.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00