]> git.ipfire.org Git - thirdparty/glibc.git/blame - locale/global-locale.c
locale/programs/locarchive.c: fix warn unused result
[thirdparty/glibc.git] / locale / global-locale.c
CommitLineData
1a0d874e 1/* Locale object representing the global locale controlled by setlocale.
6d7e8eda 2 Copyright (C) 2002-2023 Free Software Foundation, Inc.
1a0d874e
RM
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
59ba27a6 16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
1a0d874e
RM
18
19#include <locale.h>
20#include "localeinfo.h"
21
22#define DEFINE_CATEGORY(category, category_name, items, a) \
f095bb72 23extern struct __locale_data _nl_C_##category; weak_extern (_nl_C_##category)
1a0d874e
RM
24#include "categories.def"
25#undef DEFINE_CATEGORY
26
27/* Defined in locale/C-ctype.c. */
28extern const char _nl_C_LC_CTYPE_class[] attribute_hidden;
29extern const char _nl_C_LC_CTYPE_toupper[] attribute_hidden;
30extern const char _nl_C_LC_CTYPE_tolower[] attribute_hidden;
31weak_extern (_nl_C_LC_CTYPE_class)
32weak_extern (_nl_C_LC_CTYPE_toupper)
33weak_extern (_nl_C_LC_CTYPE_tolower)
34
35/* Here we define the locale object maintained by setlocale.
36 The references in the initializer are weak, so the parts of
37 the structure that are never referred to will be zero. */
38
39struct __locale_struct _nl_global_locale attribute_hidden =
40 {
41 .__locales =
42 {
43#define DEFINE_CATEGORY(category, category_name, items, a) \
44 [category] = &_nl_C_##category,
45#include "categories.def"
1ce8aaae
RM
46#undef DEFINE_CATEGORY
47 },
48 .__names =
49 {
50 [LC_ALL] = _nl_C_name,
51#define DEFINE_CATEGORY(category, category_name, items, a) \
52 [category] = _nl_C_name,
53#include "categories.def"
1a0d874e
RM
54#undef DEFINE_CATEGORY
55 },
56 .__ctype_b = (const unsigned short int *) _nl_C_LC_CTYPE_class + 128,
57 .__ctype_tolower = (const int *) _nl_C_LC_CTYPE_tolower + 128,
58 .__ctype_toupper = (const int *) _nl_C_LC_CTYPE_toupper + 128
59 };
60
61#include <tls.h>
3ce1f295 62
1a0d874e 63/* The tsd macros don't permit an initializer. */
af85385f 64__thread locale_t __libc_tsd_LOCALE = &_nl_global_locale;