Skip to content

Commit

Permalink
feat: return -2 error on missing features
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Oct 30, 2023
1 parent e00ed6a commit 9f1b75d
Show file tree
Hide file tree
Showing 40 changed files with 46 additions and 39 deletions.
2 changes: 1 addition & 1 deletion examples/mbed/z_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/mbed/z_pub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/mbed/z_pull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/mbed/z_queryable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/mbed/z_sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,6 @@ int main(void) {
printf(
"ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION or Z_FEATURE_PUBLICATION but this example "
"requires them.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_pong.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ int main(void) {
printf(
"ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION or Z_FEATURE_PUBLICATION but this example "
"requires them.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_pub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_put.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c11/z_sub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c99/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c99/z_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,6 @@ int main(void) {
printf(
"ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION or Z_FEATURE_PUBLICATION but this example "
"requires them.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c99/z_pong.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ int main(void) {
printf(
"ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION or Z_FEATURE_PUBLICATION but this example "
"requires them.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c99/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c99/z_pub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c99/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c99/z_put.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c99/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c99/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/unix/c99/z_sub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/windows/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/windows/z_ping.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,6 @@ int main(void) {
printf(
"ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION or Z_FEATURE_PUBLICATION but this example "
"requires them.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/windows/z_pong.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ int main(void) {
printf(
"ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION or Z_FEATURE_PUBLICATION but this example "
"requires them.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/windows/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/windows/z_pub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/windows/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/windows/z_put.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/windows/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/windows/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/windows/z_sub_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/zephyr/z_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERY but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/zephyr/z_pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_PUBLICATION but this example requires it.\n");
return -1;
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/zephyr/z_pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif
7 changes: 7 additions & 0 deletions examples/zephyr/z_queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <string.h>
#include <zenoh-pico.h>

#if Z_FEATURE_QUERYABLE == 1
#define CLIENT_OR_PEER 0 // 0: Client mode; 1: Peer mode
#if CLIENT_OR_PEER == 0
#define MODE "client"
Expand Down Expand Up @@ -89,3 +90,9 @@ int main(int argc, char **argv) {

return 0;
}
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_QUERYABLE but this example requires it.\n");
return -2;
}
#endif
2 changes: 1 addition & 1 deletion examples/zephyr/z_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ int main(int argc, char **argv) {
#else
int main(void) {
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this example requires it.\n");
return -1;
return -2;
}
#endif

0 comments on commit 9f1b75d

Please sign in to comment.