* [PATCH 0/2] Correct ELL header errors included C++ code.
@ 2019-01-23 19:06 Ossama Othman
2019-01-23 19:06 ` [PATCH 1/2] key: Avoid using C++ keywords as param names Ossama Othman
2019-01-23 19:06 ` [PATCH 2/2] unit: Added a minimal C++ build test Ossama Othman
0 siblings, 2 replies; 4+ messages in thread
From: Ossama Othman @ 2019-01-23 19:06 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 678 bytes --]
Including <ell/ell.h> in C++ code revealed a few C++ related conflicts
in <ell/key.h>. These patches address those errors, and add a simple
C++ build test that enabled if a C++ compiler is found when maintainer
mode is enabled.
Ossama Othman (2):
key: Avoid using C++ keywords as param names.
unit: Added a minimal C++ build test.
.gitignore | 1 +
Makefile.am | 6 ++++++
configure.ac | 3 +++
ell/key.h | 6 +++---
unit/test-cxx-build.cpp | 42 +++++++++++++++++++++++++++++++++++++++++
5 files changed, 55 insertions(+), 3 deletions(-)
create mode 100644 unit/test-cxx-build.cpp
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] key: Avoid using C++ keywords as param names.
2019-01-23 19:06 [PATCH 0/2] Correct ELL header errors included C++ code Ossama Othman
@ 2019-01-23 19:06 ` Ossama Othman
2019-01-23 19:10 ` Denis Kenzior
2019-01-23 19:06 ` [PATCH 2/2] unit: Added a minimal C++ build test Ossama Othman
1 sibling, 1 reply; 4+ messages in thread
From: Ossama Othman @ 2019-01-23 19:06 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]
Rename the parameter names "public" and "private" to avoid conflicts
with the similarly named C++ keywords. Addresses compile-time errors
in C++ code that includes <ell/key.h>.
---
ell/key.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ell/key.h b/ell/key.h
index 024afc6..0107b05 100644
--- a/ell/key.h
+++ b/ell/key.h
@@ -70,16 +70,16 @@ ssize_t l_key_get_payload_size(struct l_key *key);
bool l_key_get_info(struct l_key *key, enum l_key_cipher_type cipher,
enum l_checksum_type checksum, size_t *bits,
- bool *public);
+ bool *_public);
struct l_key *l_key_generate_dh_private(const void *prime_buf,
size_t prime_len);
-bool l_key_compute_dh_public(struct l_key *generator, struct l_key *private,
+bool l_key_compute_dh_public(struct l_key *generator, struct l_key *_private,
struct l_key *prime,
void *payload, size_t *len);
-bool l_key_compute_dh_secret(struct l_key *other_public, struct l_key *private,
+bool l_key_compute_dh_secret(struct l_key *other_public, struct l_key *_private,
struct l_key *prime,
void *payload, size_t *len);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] unit: Added a minimal C++ build test.
2019-01-23 19:06 [PATCH 0/2] Correct ELL header errors included C++ code Ossama Othman
2019-01-23 19:06 ` [PATCH 1/2] key: Avoid using C++ keywords as param names Ossama Othman
@ 2019-01-23 19:06 ` Ossama Othman
1 sibling, 0 replies; 4+ messages in thread
From: Ossama Othman @ 2019-01-23 19:06 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 2817 bytes --]
---
.gitignore | 1 +
Makefile.am | 6 ++++++
configure.ac | 3 +++
unit/test-cxx-build.cpp | 42 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 52 insertions(+)
create mode 100644 unit/test-cxx-build.cpp
diff --git a/.gitignore b/.gitignore
index 75ab7b2..f10c973 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,6 +58,7 @@ unit/test-dhcp
unit/test-dir-watch
unit/test-ecc
unit/test-ecdh
+unit/test-cxx-build
unit/cert-*.pem
unit/cert-*.csr
unit/cert-*.srl
diff --git a/Makefile.am b/Makefile.am
index 3eecbe0..e7da974 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -292,6 +292,12 @@ unit_test_ecc_LDADD = ell/libell-private.la
unit_test_ecdh_LDADD = ell/libell-private.la
unit_test_ecdh_LDFLAGS = -Wl,-wrap,l_getrandom
+if HAVE_CXX
+unit_tests += unit/test-cxx-build
+unit_test_cxx_build_SOURCES = unit/test-cxx-build.cpp
+unit_test_cxx_build_LDADD = ell/libell-private.la
+endif
+
if MAINTAINER_MODE
noinst_LTLIBRARIES += unit/example-plugin.la
endif
diff --git a/configure.ac b/configure.ac
index 1eeebec..f2d1c4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,6 +125,9 @@ fi
AM_CONDITIONAL(GLIB, test "${enable_glib}" = "yes")
if (test "$USE_MAINTAINER_MODE" = "yes"); then
+ AC_PROG_CXX
+ AM_CONDITIONAL([HAVE_CXX], [test -n "$CXX"])
+
AC_CHECK_PROG(have_openssl, [openssl], [yes], [no])
AC_CHECK_PROG(have_xxd, [xxd], [yes], [no])
fi
diff --git a/unit/test-cxx-build.cpp b/unit/test-cxx-build.cpp
new file mode 100644
index 0000000..2233815
--- /dev/null
+++ b/unit/test-cxx-build.cpp
@@ -0,0 +1,42 @@
+/*
+ *
+ * Embedded Linux library
+ *
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <ell/ell.h>
+
+int main()
+{
+ if (!l_main_init())
+ return -1;
+
+ l_log_set_stderr();
+ l_debug_enable("*");
+
+ l_debug("hello");
+
+ l_main_exit();
+
+ return 0;
+}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] key: Avoid using C++ keywords as param names.
2019-01-23 19:06 ` [PATCH 1/2] key: Avoid using C++ keywords as param names Ossama Othman
@ 2019-01-23 19:10 ` Denis Kenzior
0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2019-01-23 19:10 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 1470 bytes --]
Hi Ossama,
On 01/23/2019 01:06 PM, Ossama Othman wrote:
> Rename the parameter names "public" and "private" to avoid conflicts
> with the similarly named C++ keywords. Addresses compile-time errors
> in C++ code that includes <ell/key.h>.
Ugh... Are you seriously using ell in a C++ application? ;)
> ---
> ell/key.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/ell/key.h b/ell/key.h
> index 024afc6..0107b05 100644
> --- a/ell/key.h
> +++ b/ell/key.h
> @@ -70,16 +70,16 @@ ssize_t l_key_get_payload_size(struct l_key *key);
>
> bool l_key_get_info(struct l_key *key, enum l_key_cipher_type cipher,
> enum l_checksum_type checksum, size_t *bits,
> - bool *public);
> + bool *_public);
out_public please
>
> struct l_key *l_key_generate_dh_private(const void *prime_buf,
> size_t prime_len);
>
> -bool l_key_compute_dh_public(struct l_key *generator, struct l_key *private,
> +bool l_key_compute_dh_public(struct l_key *generator, struct l_key *_private,
And just call this private_key or private_secret
> struct l_key *prime,
> void *payload, size_t *len);
>
> -bool l_key_compute_dh_secret(struct l_key *other_public, struct l_key *private,
> +bool l_key_compute_dh_secret(struct l_key *other_public, struct l_key *_private,
> struct l_key *prime,
> void *payload, size_t *len);
>
As above.
>
Regards,
-Denis
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-01-23 19:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-23 19:06 [PATCH 0/2] Correct ELL header errors included C++ code Ossama Othman
2019-01-23 19:06 ` [PATCH 1/2] key: Avoid using C++ keywords as param names Ossama Othman
2019-01-23 19:10 ` Denis Kenzior
2019-01-23 19:06 ` [PATCH 2/2] unit: Added a minimal C++ build test Ossama Othman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.