]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/c/c-lang.cc
Update copyright years.
[thirdparty/gcc.git] / gcc / c / c-lang.cc
CommitLineData
c0f940ef 1/* Language-specific hook definitions for C front end.
83ffe9cd 2 Copyright (C) 1991-2023 Free Software Foundation, Inc.
c0f940ef 3
1322177d 4This file is part of GCC.
c0f940ef 5
1322177d
LB
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
9dcd6f09 8Software Foundation; either version 3, or (at your option) any later
1322177d 9version.
c0f940ef 10
1322177d
LB
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
c0f940ef
RS
15
16You should have received a copy of the GNU General Public License
9dcd6f09
NC
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
c0f940ef
RS
19
20
21#include "config.h"
670ee920 22#include "system.h"
4977bab6 23#include "coretypes.h"
2adfab87 24#include "c-tree.h"
69dcadff 25#include "langhooks.h"
d23c55c2 26#include "langhooks-def.h"
9a4d6480 27#include "c-objc-common.h"
4b780675 28
37fa72e9 29enum c_language_kind c_language = clk_c;
0abc6a6a 30
9a4d6480
ZL
31/* Lang hooks common to C and ObjC are declared in c-objc-common.h;
32 consequently, there should be very few hooks below. */
cd2a3ba2 33
3ac88239
NB
34#undef LANG_HOOKS_NAME
35#define LANG_HOOKS_NAME "GNU C"
69dcadff 36#undef LANG_HOOKS_INIT
460bd0e3 37#define LANG_HOOKS_INIT c_objc_common_init
81f653d6
NF
38#undef LANG_HOOKS_INIT_TS
39#define LANG_HOOKS_INIT_TS c_common_init_ts
6de9cd9a 40
895aa8e1
DM
41#if CHECKING_P
42#undef LANG_HOOKS_RUN_LANG_SELFTESTS
43#define LANG_HOOKS_RUN_LANG_SELFTESTS selftest::run_c_tests
44#endif /* #if CHECKING_P */
45
e5106e27
DM
46#undef LANG_HOOKS_GET_SUBSTRING_LOCATION
47#define LANG_HOOKS_GET_SUBSTRING_LOCATION c_get_substring_location
48
6cf276dd
DM
49#undef LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE
50#define LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE c_get_sarif_source_language
51
9a4d6480 52/* Each front end provides its own lang hook initializer. */
4537ec0c 53struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
cd2a3ba2 54
6cf276dd
DM
55/* Get a value for the SARIF v2.1.0 "artifact.sourceLanguage" property,
56 based on the list in SARIF v2.1.0 Appendix J. */
57
58const char *
59c_get_sarif_source_language (const char *)
60{
61 return "c";
62}
63
895aa8e1
DM
64#if CHECKING_P
65
66namespace selftest {
67
68/* Implementation of LANG_HOOKS_RUN_LANG_SELFTESTS for the C frontend. */
69
70void
71run_c_tests (void)
72{
b6f43128
DM
73 /* Run selftests shared within the C family. */
74 c_family_tests ();
75
76 /* Additional C-specific tests. */
895aa8e1
DM
77}
78
79} // namespace selftest
80
81#endif /* #if CHECKING_P */
82
83
e2500fed 84#include "gtype-c.h"