[llvm-commits] [llvm] r120558 - /llvm/trunk/unittests/Support/Path.cpp
Michael Spencer
bigcheesegs at gmail.com
Wed Dec 1 11:09:36 PST 2010
On Wed, Dec 1, 2010 at 1:42 PM, Jim Grosbach <grosbach at apple.com> wrote:
> When building with clang, I'm seeing a large number of diagnostics of the form:
>
> /Volumes/Home/grosbaj/sources/llvm/unittests/Support/Path.cpp:111:5: warning:
> empty macro arguments were standardized in C99 [-pedantic]
> TEST_PATH(has_stem, *i, bres);
> ^
>
> Looks like it's probably from this series of patches?
Hmm. I don't get any warnings when building on Linux with clang. Also,
none of the arguments are empty.
I'm on Kubuntu 10.10 with ToT clang building with CMake (which is
probably the causal difference).
- Michael Spencer
> On Nov 30, 2010, at 10:03 PM, Michael J. Spencer wrote:
>
>> Author: mspencer
>> Date: Wed Dec 1 00:03:33 2010
>> New Revision: 120558
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=120558&view=rev
>> Log:
>> unittests/Support/PathV2: Make tests much shorter; although harder to understand.
>>
>> I'm going to replace this all anyway with a proper table and separated tests
>> when done.
>>
>> Modified:
>> llvm/trunk/unittests/Support/Path.cpp
>>
>> Modified: llvm/trunk/unittests/Support/Path.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/Path.cpp?rev=120558&r1=120557&r2=120558&view=diff
>> ==============================================================================
>> --- llvm/trunk/unittests/Support/Path.cpp (original)
>> +++ llvm/trunk/unittests/Support/Path.cpp Wed Dec 1 00:03:33 2010
>> @@ -13,6 +13,22 @@
>>
>> using namespace llvm;
>>
>> +#define TEST_OUT(func, result) outs() << " " #func ": " << result << '\n';
>> +
>> +#define TEST_PATH_(header, func, funcname, output) \
>> + header; \
>> + if (error_code ec = sys::path::func) \
>> + ASSERT_FALSE(ec.message().c_str()); \
>> + TEST_OUT(funcname, output)
>> +
>> +#define TEST_PATH(func, ipath, res) TEST_PATH_(, func(ipath, res), func, res);
>> +
>> +#define TEST_PATH_SMALLVEC(func, ipath, inout) \
>> + TEST_PATH_(inout = ipath, func(inout), func, inout)
>> +
>> +#define TEST_PATH_SMALLVEC_P(func, ipath, inout, param) \
>> + TEST_PATH_(inout = ipath, func(inout, param), func, inout)
>> +
>> namespace {
>>
>> TEST(Support, Path) {
>> @@ -80,56 +96,26 @@
>> }
>> outs() << "]\n";
>>
>> - StringRef res;
>> + StringRef sfres;
>> + TEST_PATH(root_path, *i, sfres);
>> + TEST_PATH(root_name, *i, sfres);
>> + TEST_PATH(root_directory, *i, sfres);
>> + TEST_PATH(parent_path, *i, sfres);
>> + TEST_PATH(filename, *i, sfres);
>> + TEST_PATH(stem, *i, sfres);
>> + TEST_PATH(extension, *i, sfres);
>> +
>> SmallString<16> temp_store;
>> - if (error_code ec = sys::path::root_path(*i, res))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " root_path: " << res << '\n';
>> - if (error_code ec = sys::path::root_name(*i, res))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " root_name: " << res << '\n';
>> - if (error_code ec = sys::path::root_directory(*i, res))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " root_directory: " << res << '\n';
>> - if (error_code ec = sys::path::parent_path(*i, res))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " parent_path: " << res << '\n';
>> - if (error_code ec = sys::path::filename(*i, res))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " filename: " << res << '\n';
>> - if (error_code ec = sys::path::stem(*i, res))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " stem: " << res << '\n';
>> - if (error_code ec = sys::path::extension(*i, res))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " stem: " << res << '\n';
>> -
>> - temp_store = *i;
>> - if (error_code ec = sys::path::make_absolute(temp_store))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " make_absolute: " << temp_store << '\n';
>> - temp_store = *i;
>> - if (error_code ec = sys::path::remove_filename(temp_store))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " remove_filename: " << temp_store << '\n';
>> - temp_store = *i;
>> - if (error_code ec = sys::path::replace_extension(temp_store, "ext"))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " replace_extension: " << temp_store << '\n';
>> - StringRef stem, ext;
>> - if (error_code ec = sys::path::stem(
>> - StringRef(temp_store.begin(), temp_store.size()), stem))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " stem: " << stem << '\n';
>> - if (error_code ec = sys::path::extension(
>> - StringRef(temp_store.begin(), temp_store.size()), ext))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " extension: " << ext << '\n';
>> - EXPECT_EQ(*(--sys::path::end(
>> - StringRef(temp_store.begin(), temp_store.size()))), (stem + ext).str());
>> - if (error_code ec = sys::path::native(*i, temp_store))
>> - ASSERT_FALSE(ec.message().c_str());
>> - outs() << " native: " << temp_store << '\n';
>> + TEST_PATH_SMALLVEC(make_absolute, *i, temp_store);
>> + TEST_PATH_SMALLVEC(remove_filename, *i, temp_store);
>> +
>> + TEST_PATH_SMALLVEC_P(replace_extension, *i, temp_store, "ext");
>> + StringRef filename(temp_store.begin(), temp_store.size()), stem, ext;
>> + TEST_PATH(stem, filename, stem);
>> + TEST_PATH(extension, filename, ext);
>> + EXPECT_EQ(*(--sys::path::end(filename)), (stem + ext).str());
>> +
>> + TEST_PATH_(, native(*i, temp_store), native, temp_store);
>>
>> outs().flush();
>> }
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
More information about the llvm-commits
mailing list