Skip to content

Commit

Permalink
Add c++ guards to internal headers and sources as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
pmatilai committed Apr 5, 2024
1 parent d4b0663 commit 401d845
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/rpmug.h
Expand Up @@ -4,6 +4,10 @@
#include <rpm/rpmutil.h>
#include <sys/types.h>

#ifdef __cplusplus
extern "C" {
#endif

RPM_GNUC_INTERNAL
int rpmugUid(const char * name, uid_t * uid);

Expand All @@ -19,4 +23,9 @@ const char * rpmugGname(gid_t gid);
RPM_GNUC_INTERNAL
void rpmugFree(void);

#ifdef __cplusplus
}
#endif


#endif /* _RPMUG_H */
9 changes: 9 additions & 0 deletions rpmio/rpmpgp_sequoia.c
Expand Up @@ -24,6 +24,10 @@
return _##f args; \
}

#ifdef __cplusplus
extern "C" {
#endif

W(int, pgpSignatureType, (pgpDigParams _digp), (_digp))
W(pgpDigParams, pgpDigParamsFree, (pgpDigParams digp), (digp))
W(int, pgpDigParamsCmp, (pgpDigParams p1, pgpDigParams p2), (p1, p2))
Expand Down Expand Up @@ -80,3 +84,8 @@ W(int, rpmDigestUpdate, (DIGEST_CTX ctx, const void * data, size_t len),
W(int, rpmDigestFinal,
(DIGEST_CTX ctx, void ** datap, size_t *lenp, int asAscii),
(ctx, datap, lenp, asAscii))

#ifdef __cplusplus
}
#endif

1 change: 0 additions & 1 deletion sign/rpmsignfiles.c
Expand Up @@ -5,7 +5,6 @@
*/

#include "system.h"
#include "imaevm.h"

#include <string.h>
#include <rpm/rpmstring.h>
Expand Down
3 changes: 3 additions & 0 deletions sign/rpmsignfiles.h
Expand Up @@ -8,6 +8,9 @@
extern "C" {
#endif

/* This doesn't have c++ guards on its own */
#include <imaevm.h>

/**
* Sign file digests in header into signature header
* @param sigh package signature header
Expand Down
8 changes: 8 additions & 0 deletions tools/cliutils.h
Expand Up @@ -13,6 +13,10 @@
/* "normalized" exit: avoid overflowing and xargs special value 255 */
#define RETVAL(rc) (((rc) > 254) ? 254 : (rc))

#ifdef __cplusplus
extern "C" {
#endif

RPM_GNUC_NORETURN
void argerror(const char * desc);

Expand All @@ -22,4 +26,8 @@ int initPipe(void);

int finishPipe(void);

#ifdef __cplusplus
}
#endif

#endif /* _CLIUTIL_H */

1 comment on commit 401d845

@mlschroe
Copy link
Contributor

Choose a reason for hiding this comment

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

This breaks the build if IMA support is not configured and there is no imaevm.h header file. You need to put a
#ifdef WITH_IMAEVM around the #include "rpmsignfiles.h" in sign/rpmgensig.c

Please sign in to comment.