-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat common: slight code improvement #9
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
build/ | ||
subprojects/libblkio/ | ||
.* | ||
/build_*/ | ||
/build/ | ||
/subprojects/libblkio/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ message("Libvhost log verbosity: ${LIBVHOST_LOG_VERBOSITY}") | |
add_library(vhost-server) | ||
add_compile_definitions(_GNU_SOURCE LOG_VERBOSITY=${LIBVHOST_LOG_VERBOSITY}) | ||
target_compile_options(vhost-server PRIVATE | ||
-std=gnu17 | ||
-Wall | ||
-Werror | ||
-Wextra | ||
|
@@ -61,3 +62,6 @@ target_sources(vhost-server PRIVATE | |
virtio/virtio_blk.c | ||
virtio/virtio_fs.c | ||
) | ||
|
||
|
||
add_subdirectory(tests) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, I'm not sure NBS needs the tests subdirectory for their integration (and this might break their isolated build as well) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is very unusual to be selective about build systems and focus on only one consumer for an open source project. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Building tests makes sense and NBS will fix their build if building tests break it. So I think this is a good idea to build tests. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
find_library(LIBAIO NAMES aio REQUIRED) | ||
|
||
add_executable(vhost-user-blk-test-server vhost_user_blk_test_server.c) | ||
target_include_directories(vhost-user-blk-test-server | ||
PRIVATE | ||
./ | ||
../ # TODO: remove external directories | ||
) | ||
target_link_libraries(vhost-user-blk-test-server | ||
vhost-server | ||
${LIBAIO} | ||
) | ||
target_compile_options(vhost-user-blk-test-server PRIVATE | ||
-std=gnu17 | ||
-Wall | ||
-Werror | ||
-Wextra | ||
-Wno-unused-parameter | ||
-g | ||
-O2 | ||
|
||
-Wno-error=unused-result | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This CMakeLists.txt was introduced by NBS since they integrate libvhost as part of their project, we don't actually build with it locally.
This will need to be checked in with them (might break their build).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code is compiled exclusively by gnu extensions of the standard, it is worth explicitly denoting this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aikuchin Would you be okay with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need 17 here? I was quite sure that 11 was enough, maybe 14, but 17 seems like an overkill and will limit supported compilers significantly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C14 does not exist. C17 is supported by GCC 8.1 and Clang 7. C23 causes confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to understand the motivation for gnu17 if we only use features for gnu11. Why do we need 17, do we ?If we need new compiler features it is easy to bump requirements in new version, but downgrading standard is always more complicated.
UPD: Since c17 is just a bugfix release for c11 I agree that gnu17 is OK here.
And should we also add required standard version to meson.build?