aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-08-09 09:34:50 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2024-08-09 09:34:50 +0200
commit723e0f724e0c884a31ddf4a688604e7163ed31f2 (patch)
treeeb2f4467b1a2227ee90373bd91a0e33de1d03243 /gcc
parent19e565ed13972410451091a789fe58638d03b795 (diff)
downloadgcc-723e0f724e0c884a31ddf4a688604e7163ed31f2.zip
gcc-723e0f724e0c884a31ddf4a688604e7163ed31f2.tar.gz
gcc-723e0f724e0c884a31ddf4a688604e7163ed31f2.tar.bz2
c-family: Add some more ARRAY_SIZE uses
These two spots were just non-standard, because they divided sizeof (omp_pragmas_simd) by sizeof (*omp_pragmas) and not the expected sizeof (*omp_pragmas_simd) and so weren't converted into ARRAY_SIZE. Both of the latter sizes are the same though, as both arrays have the same type, so this patch doesn't change anything but readability. 2024-08-09 Jakub Jelinek <jakub@redhat.com> * c-pragma.cc (c_pp_lookup_pragma): Use ARRAY_SIZE in n_omp_pragmas_simd initializer. (init_pragmas): Likewise.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/c-pragma.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/gcc/c-family/c-pragma.cc b/gcc/c-family/c-pragma.cc
index 25251c2..ed2a7a0 100644
--- a/gcc/c-family/c-pragma.cc
+++ b/gcc/c-family/c-pragma.cc
@@ -1565,8 +1565,7 @@ c_pp_lookup_pragma (unsigned int id, const char **space, const char **name)
{
const int n_oacc_pragmas = ARRAY_SIZE (oacc_pragmas);
const int n_omp_pragmas = ARRAY_SIZE (omp_pragmas);
- const int n_omp_pragmas_simd = sizeof (omp_pragmas_simd)
- / sizeof (*omp_pragmas);
+ const int n_omp_pragmas_simd = ARRAY_SIZE (omp_pragmas_simd);
int i;
for (i = 0; i < n_oacc_pragmas; ++i)
@@ -1807,8 +1806,7 @@ init_pragma (void)
}
if (flag_openmp || flag_openmp_simd)
{
- const int n_omp_pragmas_simd
- = sizeof (omp_pragmas_simd) / sizeof (*omp_pragmas);
+ const int n_omp_pragmas_simd = ARRAY_SIZE (omp_pragmas_simd);
int i;
for (i = 0; i < n_omp_pragmas_simd; ++i)