From c9852156dd2fedec130f6d8eb669579ef6237946 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 17 May 2022 20:46:29 +0200 Subject: Revert 'Use more ARRAY_SIZE.' for mkoffload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Revert commit r13-472-gca32b29ec3e92dcf8dda5c2501d0baf9dd1cb09d partially; namely for {gcn,nvptx}/mkoffload.cc, only. The patch changed 'sizeof(...)/sizeof(...[0])' to the 'ARRAY_SIZE' macro, which is in principle a good idea – except that in the two mkoffload.cc, the change happened inside a string that is used to generate plain C code. With offlading to nvptx or gcn, the mkoffload genenates then the C file and compilation of the latter fails with "warning: implicit declaration of function 'ARRAY_SIZE'" followed by "error: initializer element is not constant" gcc/ * config/gcn/mkoffload.cc (process_obj): Revert: Use ARRAY_SIZE. * config/nvptx/mkoffload.cc (process): Likewise. --- gcc/config/nvptx/mkoffload.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/config/nvptx') diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc index fa3b4b7..b28c1a3 100644 --- a/gcc/config/nvptx/mkoffload.cc +++ b/gcc/config/nvptx/mkoffload.cc @@ -316,11 +316,11 @@ process (FILE *in, FILE *out) " const struct nvptx_fn *fn_names;\n" " unsigned fn_num;\n" "} target_data = {\n" - " ptx_objs, ARRAY_SIZE (ptx_objs),\n" + " ptx_objs, sizeof (ptx_objs) / sizeof (ptx_objs[0]),\n" " var_mappings," - " ARRAY_SIZE (var_mappings),\n" + " sizeof (var_mappings) / sizeof (var_mappings[0]),\n" " func_mappings," - " ARRAY_SIZE (func_mappings)\n" + " sizeof (func_mappings) / sizeof (func_mappings[0])\n" "};\n\n"); fprintf (out, "#ifdef __cplusplus\n" -- cgit v1.1