aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Mantellini <angelo.mantellini@irt-systemx.fr>2019-01-17 10:57:04 +0100
committerAngelo Mantellini <angelo.mantellini@irt-systemx.fr>2019-01-17 10:57:04 +0100
commit82317aed7d4b6acd4fb65441a106f9de4d9c8926 (patch)
tree838978d06dd65371365316b1005f08404beac25c
parent33b53c7f5cef4cf19770a38baa4b627f234322cf (diff)
add clang directives to avoid warnings
Change-Id: I1ed298176ad1403ed089177a3cce4264f028bbbd Signed-off-by: Angelo Mantellini <angelo.mantellini@irt-systemx.fr>
-rw-r--r--libparc/parc/algol/parc_Object.h27
-rw-r--r--libparc/parc/security/parc_CertificateFactory.c2
-rw-r--r--libparc/parc/security/parc_PublicKeySigner.c4
-rw-r--r--libparc/parc/security/parc_X509Certificate.c2
4 files changed, 34 insertions, 1 deletions
diff --git a/libparc/parc/algol/parc_Object.h b/libparc/parc/algol/parc_Object.h
index b1a4855..ac7e965 100644
--- a/libparc/parc/algol/parc_Object.h
+++ b/libparc/parc/algol/parc_Object.h
@@ -598,7 +598,33 @@ const PARCObjectDescriptor *parcObject_SetDescriptor(PARCObject *object, const P
* The new `PARCObjectDescriptor` uses the existing `PARCObjectDescriptor` as the super-type of the new descriptor.
*/
+#ifdef __clang__
#define parcObject_Extends(_subtype, _superType, ...) \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Winitializer-overrides\"") \
+ parcObjectDescriptor_Declaration(_subtype) = { \
+ .super = &parcObject_DescriptorName(_superType), \
+ .name = #_subtype, \
+ .objectSize = 0, \
+ .objectAlignment = 0, \
+ .destroy = NULL, \
+ .destructor = NULL, \
+ .release = NULL, \
+ .copy = NULL, \
+ .toString = NULL, \
+ .equals = NULL, \
+ .compare = NULL, \
+ .hashCode = NULL, \
+ .toJSON = NULL, \
+ .display = NULL, \
+ .isLockable = true, \
+ .typeState = NULL, \
+ __VA_ARGS__ \
+ }; \
+ _Pragma("GCC diagnostic pop") \
+ const PARCObjectDescriptor parcObject_DescriptorName(_subtype)
+#else
+ #define parcObject_Extends(_subtype, _superType, ...) \
_Pragma("GCC diagnostic ignored \"-Woverride-init\"") \
parcObjectDescriptor_Declaration(_subtype) = { \
.super = &parcObject_DescriptorName(_superType), \
@@ -621,6 +647,7 @@ const PARCObjectDescriptor *parcObject_SetDescriptor(PARCObject *object, const P
}; \
_Pragma("GCC diagnostic warning \"-Woverride-init\"") \
const PARCObjectDescriptor parcObject_DescriptorName(_subtype)
+#endif
/**
* Define a new PARC Object implementation, by composing a new PARC Object Descriptor referencing an old one.
diff --git a/libparc/parc/security/parc_CertificateFactory.c b/libparc/parc/security/parc_CertificateFactory.c
index 52cef4a..c737e42 100644
--- a/libparc/parc/security/parc_CertificateFactory.c
+++ b/libparc/parc/security/parc_CertificateFactory.c
@@ -91,6 +91,8 @@ parcCertificateFactory_CreateSelfSignedCertificate(PARCCertificateFactory *facto
case PARCSigningAlgorithm_ECDSA:
certificate = parcX509Certificate_CreateSelfSignedCertificate(privateKey, subjectName, (int) keyLength, valdityDays, PARCKeyType_EC);
break;
+ default:
+ break;
}
// This may fail.
diff --git a/libparc/parc/security/parc_PublicKeySigner.c b/libparc/parc/security/parc_PublicKeySigner.c
index 0a029ca..1297611 100644
--- a/libparc/parc/security/parc_PublicKeySigner.c
+++ b/libparc/parc/security/parc_PublicKeySigner.c
@@ -213,7 +213,7 @@ static inline int _SignDigestECDSA(const PARCCryptoHash *digestToSign, PARCBuffe
ec_key);
parcAssertTrue(result == 1, "Got error from ECDSA_sign: %d", result);
EC_KEY_free(ec_key);
-
+ return result;
}
static PARCSignature *
@@ -307,6 +307,8 @@ _GetSignatureSize(PARCPublicKeySigner *signer)
EVP_PKEY_free(privateKey);
break;
}
+ default:
+ break;
}
parcBuffer_Release(&privateKeyBuffer);
diff --git a/libparc/parc/security/parc_X509Certificate.c b/libparc/parc/security/parc_X509Certificate.c
index 497cff9..2c964ae 100644
--- a/libparc/parc/security/parc_X509Certificate.c
+++ b/libparc/parc/security/parc_X509Certificate.c
@@ -609,6 +609,8 @@ parcX509Certificate_CreateSelfSignedCertificate(PARCBuffer **privateKeyBuffer, c
return _createSelfSignedCertificate_RSA(privateKeyBuffer, subjectName, keyLength, validityDays);
case PARCKeyType_EC:
return _createSelfSignedCertificate_EC(privateKeyBuffer, subjectName, keyLength, validityDays);
+ default:
+ break;
}
return NULL;