X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Favoids_cpp_reserved.c;h=72b3604efa45478c4f8d59110d92bc37bca9880a;hb=87c679ff36d7b198862cd2652a384d90f89f3b2b;hp=a1663ad571346cc6e221e17e5c506e56031e8f78;hpb=076877c266706ba432987195422a1e8653bd0c3b;p=ccan diff --git a/tools/ccanlint/tests/avoids_cpp_reserved.c b/tools/ccanlint/tests/avoids_cpp_reserved.c index a1663ad5..72b3604e 100644 --- a/tools/ccanlint/tests/avoids_cpp_reserved.c +++ b/tools/ccanlint/tests/avoids_cpp_reserved.c @@ -36,7 +36,6 @@ static struct ccan_file *main_header(struct manifest *m) } static void check_headers_no_cpp(struct manifest *m, - bool keep, unsigned int *timeleft, struct score *score) { char *contents; @@ -44,8 +43,8 @@ static void check_headers_no_cpp(struct manifest *m, int fd; struct ccan_file *mainh = main_header(m); - tmpsrc = maybe_temp_file(m, "-included.c", keep, mainh->fullname); - tmpobj = maybe_temp_file(m, ".o", keep, tmpsrc); + tmpsrc = temp_file(m, "-included.c", mainh->fullname); + tmpobj = temp_file(m, ".o", tmpsrc); /* We don't fail you for this. */ score->pass = true; @@ -54,15 +53,37 @@ static void check_headers_no_cpp(struct manifest *m, err(1, "Creating temporary file %s", tmpsrc); contents = talloc_asprintf(tmpsrc, + "#define alignas #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" "#define class #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" - "#define private #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define constexpr #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define const_cast #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define decltype #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define delete #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define dynamic_cast #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define explicit #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define false #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define friend #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define mutable #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define namespace #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define new #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define nullptr #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define operator #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" "#define public #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define private #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" "#define protected #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define reinterpret_cast #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define static_assert #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define static_cast #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" "#define template #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" "#define this #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" - "#define new #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" - "#define delete #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" - "#define friend #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define thread_local #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define throw #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define true #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define try #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define typeid #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define typename #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define using #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" + "#define virtual #DONT_USE_CPLUSPLUS_RESERVED_NAMES\n" "#include \n", m->basename, m->basename); if (write(fd, contents, strlen(contents)) != strlen(contents))