Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean: Assorted Meson and clang-tidy fixes #673

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ on:
- 'CMakeLists.txt'
- '.github/workflows/build-and-test.yaml'
- 'src/nanoarrow/**'
- 'meson.build'

permissions:
contents: read
Expand Down
5 changes: 5 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ add_project_arguments(
language : 'cpp'
)

if get_option('buildtype') in ['debug', 'debugoptimized']
add_project_arguments('-DNANOARROW_DEBUG', language: 'c')
add_project_arguments('-DNANOARROW_DEBUG', language: 'cpp')
endif

nanoarrow_dep_args = []
if host_machine.system() == 'windows' and get_option('default_library') == 'shared'
add_project_arguments(['-DNANOARROW_BUILD_DLL', '-DNANOARROW_EXPORT_DLL'], language: 'c')
Expand Down
23 changes: 12 additions & 11 deletions src/nanoarrow/ipc/decoder_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -856,14 +856,14 @@ TEST_P(ArrowTypeParameterizedTestFixture, NanoarrowIpcNanoarrowArrayRoundtrip) {
EXPECT_EQ(ArrowIpcDecoderSetSchema(decoder.get(), schema.get(), &error), NANOARROW_OK)
<< error.message;
EXPECT_EQ(ArrowIpcDecoderDecodeHeader(decoder.get(),
{buffer->data, buffer->size_bytes}, &error),
{{buffer->data}, buffer->size_bytes}, &error),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of the changes to this file suppress the warning of:

/home/willayd/clones/arrow-nanoarrow/builddir/../src/nanoarrow/ipc/decoder_test.cc:859:44: warning: suggest braces around initialization of subobject [clang-diagnostic-missing-braces]

NANOARROW_OK)
<< error.message;

struct ArrowArrayView* roundtripped;
ASSERT_EQ(ArrowIpcDecoderDecodeArrayView(decoder.get(),
{body_buffer->data, body_buffer->size_bytes},
-1, &roundtripped, nullptr),
ASSERT_EQ(ArrowIpcDecoderDecodeArrayView(
decoder.get(), {{body_buffer->data}, body_buffer->size_bytes}, -1,
&roundtripped, nullptr),
NANOARROW_OK);

AssertArrayViewIdentical(roundtripped, array_view.get());
Expand Down Expand Up @@ -1232,34 +1232,35 @@ TEST(NanoarrowIpcTest, NanoarrowIpcFooterDecodingErrors) {
ArrowIpcDecoderInit(decoder.get());

// not enough data to get the size+magic
EXPECT_EQ(ArrowIpcDecoderPeekFooter(decoder.get(), {nullptr, 3}, &error), ESPIPE)
EXPECT_EQ(ArrowIpcDecoderPeekFooter(decoder.get(), {{nullptr}, 3}, &error), ESPIPE)
<< error.message;

// doesn't end with magic
EXPECT_EQ(ArrowIpcDecoderPeekFooter(decoder.get(), {"\0\0\0\0blargh", 10}, &error),
EXPECT_EQ(ArrowIpcDecoderPeekFooter(decoder.get(), {{"\0\0\0\0blargh"}, 10}, &error),
EINVAL)
<< error.message;

// negative size
EXPECT_EQ(ArrowIpcDecoderPeekFooter(decoder.get(),
{"\xFF\xFF\xFF\xFF"
"ARROW1",
{{"\xFF\xFF\xFF\xFF"
"ARROW1"},
10},
&error),
EINVAL)
<< error.message;

// PeekFooter doesn't check for available data
EXPECT_EQ(ArrowIpcDecoderPeekFooter(decoder.get(), {"\xFF\xFF\0\0ARROW1", 10}, &error),
NANOARROW_OK)
EXPECT_EQ(
ArrowIpcDecoderPeekFooter(decoder.get(), {{"\xFF\xFF\0\0ARROW1"}, 10}, &error),
NANOARROW_OK)
<< error.message;
EXPECT_EQ(decoder->header_size_bytes, 0xFFFF);

decoder->header_size_bytes = -1;

// VerifyFooter *does* check for enough available data
EXPECT_EQ(
ArrowIpcDecoderVerifyFooter(decoder.get(), {"\xFF\xFF\0\0ARROW1", 10}, &error),
ArrowIpcDecoderVerifyFooter(decoder.get(), {{"\xFF\xFF\0\0ARROW1"}, 10}, &error),
ESPIPE)
<< error.message;
EXPECT_EQ(decoder->header_size_bytes, 0xFFFF);
Expand Down
Loading