-
Notifications
You must be signed in to change notification settings - Fork 122
Conversation
@kodebach @markus2330 Can you please help me with the Cmake fixing? I try to remove the code generation but I cannot fix the Cmake dependencies correctly (without probably severe time investment) Currently I receive the following error message:
|
AFAIK the stuff that is generated from |
Similarly |
src/include/CMakeLists.txt
Outdated
@@ -170,6 +170,7 @@ install (FILES kdbextension.h | |||
"${CMAKE_CURRENT_BINARY_DIR}/kdbtypes.h" | |||
kdbhelper.h | |||
"${CMAKE_CURRENT_BINARY_DIR}/kdb.h" | |||
"${CMAKE_CURRENT_BINARY_DIR}/kdberrors.h" |
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.
kdberrors.h
should not be installed, it shouldn't be used outside of Elektra. Why did you add it?
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 removed it. I was not aware that this should not be installed
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.
@kodebach are you sure about that? The file might be helpful for out-of-source-tree development of plugins. As this is currently not a priority, I think it is a good thing to not install any private files.
If we install private files, we should install in a subdirectory (private).
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.
The old version of kdberrors.h
wasn't suitable for installation IMO. The new version could be installed, but we should first decide, whether or not we want to remove the F
variants of the macros (see #2490 (comment)).
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'll see how the new header file looks like.
src/include/CMakeLists.txt
Outdated
@@ -190,7 +191,7 @@ install (FILES kdbextension.h | |||
|
|||
add_custom_target (elektra_config_headers ALL | |||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/kdb.h ${CMAKE_CURRENT_BINARY_DIR}/kdbconfig.h | |||
${CMAKE_CURRENT_BINARY_DIR}/kdbversion.h) | |||
${CMAKE_CURRENT_BINARY_DIR}/kdbversion.h ${CMAKE_CURRENT_BINARY_DIR}/kdberrors.h) |
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.
Not sure, what this custom target is, but I'm pretty sure kdberrors.h
shouldn't be in here. Even if it was included, the ${CMAKE_CURRENT_BINARY_DIR}/
part is wrong, since that is not where the header is located anymore.
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.
removed it
There is some formatting problem in "function (add_lib name)". which makes the PR hard to read. The error message is very clear, it cannot find elektra/errors.h. This most likely has nothing to do with CMake as no deps are needed for non-generated header files. |
src/include/kdberrors.h
Outdated
#include <string.h> | ||
|
||
#ifdef __cplusplus | ||
using namespace ckdb; |
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.
@markus2330 I just saw this line... We really should remove that, using
directives in headers are very much not good practice. I suspect however, some files already rely on this line being here, so this could be a rather big 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.
Yes, this definitely need to be removed. Thanks for the hint. I did not look so far into the PR.
I think also some other things will come up as kdberrors.h will be much easier to read in the non-generated way.
No part of the header is actually used anywhere, so the |
I upgraded my @kodebach was so kind and sent me his version of refactoring from the generation which he had done a time ago. Big thanks!
Do you have a clue there? |
Ah, that is probably what happens, when we remove gcc actually tells you the solution already:
But for For headers, we shouldn't do that (same reason why |
It looks like I could fix most of those problems on my own with your help (thank you!) but now ran into a problem concerning the highlevel files:
|
These lines should be remove: libelektra/src/libs/highlevel/CMakeLists.txt Lines 3 to 6 in 5519cb8
|
@kodebach I receive some warnings in the jenkins build which I think causes it to fail:
do I need to change this to |
@markus2330 did I understand strncpy correctly in the upper comment? I am rarely that unsure about fixing something but since @kodebach is that proficient in C I assume a fix from me on his code is more likely another bug than a fix. |
Sorry, i missed this.
That won't work, I always found this GCC warning somewhat annoying. It warns you about perfectly correct code... |
Thank you for your help!
why 8 and not 7? is it for |
Yes |
diff --git a/src/plugins/crypto/botan_operations.h b/src/plugins/crypto/botan_operations.h
index e2b66e22a..108f941ea 100644
--- a/src/plugins/crypto/botan_operations.h
+++ b/src/plugins/crypto/botan_operations.h
@@ -13,6 +13,11 @@
#include <kdb.h>
#include <kdbtypes.h>
+#ifdef __cplusplus
+extern "C" {
+using namespace ckdb;
+#endif
+
#define ELEKTRA_CRYPTO_BOTAN_KEYSIZE (32)
#define ELEKTRA_CRYPTO_BOTAN_BLOCKSIZE (16)
#define ELEKTRA_CRYPTO_BOTAN_ALGORITHM "AES-256/CBC"
@@ -22,4 +27,8 @@ int elektraCryptoBotanInit (Key * errorKey);
int elektraCryptoBotanEncrypt (KeySet * pluginConfig, Key * k, Key * errorKey, Key * masterKey);
int elektraCryptoBotanDecrypt (KeySet * pluginConfig, Key * k, Key * errorKey, Key * masterKey);
+#ifdef __cplusplus
+}
+#endif
+
#endif Applying this diff should fix the namespace problems for Botan. |
jenkins build libelektra please |
1 similar comment
jenkins build libelektra please |
@markus2330 please take a look through the PR, all I am left to do is restart the jenkins until it finally gives green light to merge |
jenkins build libelektra please |
The current build has been running for 9h 34m 56s. Can we kill/restart that? |
yes please, I tried to restart it already with the restart command here |
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.
Looks good, a lot of code removed!
src/include/kdberrors.h
Outdated
/** | ||
* @file | ||
* | ||
* @brief |
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.
Please write a sentence what this file is for.
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
using Key = ckdb::Key; |
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.
using should not be used in header files. Did you have any luck with completely removing ckdb?
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.
No, I have tried it but failed due to my insufficient lack of C/C++ skills.
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.
Removing the ckdb
namespace should be pretty easy, but it should be a separate PR since it affects many files. I can do it after #3115, if no one else has the time/knowledge.
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.
Maybe @Piankero can try again, 90% of the effort should be to simply remove all occurrences of the text string "ckdb".
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.
yeah sure, I can write that regex remove those occurrences and open a PR for @kodebach to continue?
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.
Yes, it would be nice if you could start the PR. Just using a regex won't work since you cannot correctly remove the closing brackets corresponding to namespace ckdb {
declarations. But that shouldn't be too much effort to do manually.
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.
no problem, I will create it in your repository tomorrow morning.
Just to be sure:
I should remove all ckdb::
as well as all namespace ckdb {
+ }
occurrences?
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 should remove all ckdb:: as well as all namespace ckdb { + } occurrences?
The safest thing would be too replace ckdb::
with just ::
, e.g. replacing ckdb::Key
to ::Key
. That way we explicitly refer to the global namespace and shouldn't run into any problems, if someone used for example using namespace kdb;
and then ckdb::Key
.
#endif | ||
|
||
#ifndef ELEKTRA_MODULE_NAME | ||
#define ELEKTRA_MODULE_NAME kdb |
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 would prefer if we set the modules at the appropriate places and not having a catch-all here. Which places do not set the ELEKTRA_MODULE_NAME?
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.
When I implemented the new error codes I was not able to implement this for the core of elektra. Every plugin sets it correctly (guaranteed via the cmake LibAddPlugin). I remember also a longer discussion with @kodebach why this was difficult/ not possible but cannot remember the actual reasons.
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.
If you cannot remember, please remove and find out.
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.
The module name should be set in CMake (as a compiler argument), whenever we want something other than "kdb". AFAIK this is currently done in add_plugin
and maybe also add_lib
.
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.
Yes, but the question was if we need this default "kdb". Which module does not have any name set? We should fix that to not get the possibly wrong module name "kdb".
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 think elektra-core
and elektra-kdb
don't set a module name. In any case we should either have a default set or replace the #define
with an error, otherwise the module name will be set to ELEKTRA_MODULE_NAME
since the macro is simply not replaced.
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.
Yes, good objection. Of course it should be an error and not simply removed.
@@ -132,6 +132,29 @@ libelektra_0.8 { | |||
elektraKeySetName; | |||
}; | |||
|
|||
libelektra_1.0 { | |||
# kdberrors.h | |||
ELEKTRA_ERROR_RESOURCE; |
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.
These are macros and not symbols? Why are they added here?
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.
After various frustrating attempts I asked @kodebach for help despite I wanted to implement it myself. He added those lines
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 actually didn't add those lines I just moved them from the private part below since they should be accessible by applications. However, you are right they are macros we should be able to remove those lines.
@@ -13,6 +13,12 @@ | |||
#include <kdb.h> | |||
#include <kdbtypes.h> | |||
|
|||
#ifdef __cplusplus | |||
extern "C" { | |||
using Key = ckdb::Key; |
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.
Also here using should be avoided.
This reverts commit 636b218
It had a conflict so I needed to rebase. After the build servers passes please merge it |
jenkins build libelektra please |
Thank you, I am looking forward to the follow-up. |
Basics
Check relevant points but please do not remove entries.
Do not describe the purpose of this PR in the PR description but:
doc/news/_preparation_next_release.md
which contains_(my name)_
)Please always add something to the the release notes.
(first line should have
module: short statement
syntax)close #X
, should be in the commit messages.Checklist
Check relevant points but please do not remove entries.
For docu fixes, spell checking, and similar none of these points below
need to be checked.
Review
Reviewers will usually check the following:
Labels
say that everything is ready to be merged.