From 3adde469bf542407a9f9a42593500af8bad76738 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Thu, 8 Jun 2017 16:57:35 +0200 Subject: Bug 1357319 - Add proper Makefile for cpputil r=mt Differential Revision: https://nss-review.dev.mozaws.net/D349 --- cpputil/Makefile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ cpputil/config.mk | 15 +++++++++++++++ cpputil/manifest.mn | 18 ++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 cpputil/Makefile create mode 100644 cpputil/config.mk create mode 100644 cpputil/manifest.mn (limited to 'cpputil') diff --git a/cpputil/Makefile b/cpputil/Makefile new file mode 100644 index 000000000..7adfc6117 --- /dev/null +++ b/cpputil/Makefile @@ -0,0 +1,49 @@ +#! gmake +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +####################################################################### +# (1) Include initial platform-independent assignments (MANDATORY). # +####################################################################### + +include manifest.mn + +####################################################################### +# (2) Include "global" configuration information. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/config.mk + +####################################################################### +# (3) Include "component" configuration information. (OPTIONAL) # +####################################################################### + +ifeq (WINNT,$(OS_ARCH)) +OS_CFLAGS += -EHsc +else +CXXFLAGS += -std=c++0x +endif + +####################################################################### +# (4) Include "local" platform-dependent assignments (OPTIONAL). # +####################################################################### + +include config.mk + +####################################################################### +# (5) Execute "global" rules. (OPTIONAL) # +####################################################################### + +include $(CORE_DEPTH)/coreconf/rules.mk + +####################################################################### +# (6) Execute "component" rules. (OPTIONAL) # +####################################################################### + + + +####################################################################### +# (7) Execute "local" rules. (OPTIONAL). # +####################################################################### diff --git a/cpputil/config.mk b/cpputil/config.mk new file mode 100644 index 000000000..b8c03de79 --- /dev/null +++ b/cpputil/config.mk @@ -0,0 +1,15 @@ +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# +# Override TARGETS variable so that only static libraries +# are specifed as dependencies within rules.mk. +# + +TARGETS = $(LIBRARY) +SHARED_LIBRARY = +IMPORT_LIBRARY = +PROGRAM = + diff --git a/cpputil/manifest.mn b/cpputil/manifest.mn new file mode 100644 index 000000000..ad2d31b45 --- /dev/null +++ b/cpputil/manifest.mn @@ -0,0 +1,18 @@ +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +CORE_DEPTH = .. +DEPTH = .. + +MODULE = nss +LIBRARY_NAME = cpputil + +CPPSRCS = \ + dummy_io.cc \ + dummy_io_fwd.cc \ + tls_parser.cc \ + $(NULL) + +EXPORTS = \ + $(NULL) -- cgit v1.2.1 From 2821ed9da4b05bceddb930961be28e07d320c7e6 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Thu, 1 Jun 2017 10:47:30 +0200 Subject: Bug 1280846 - tests: adjust gtests to compile under modular builds, r=franziskus --- cpputil/scoped_ptrs_util.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 cpputil/scoped_ptrs_util.h (limited to 'cpputil') diff --git a/cpputil/scoped_ptrs_util.h b/cpputil/scoped_ptrs_util.h new file mode 100644 index 000000000..2dbf34e1d --- /dev/null +++ b/cpputil/scoped_ptrs_util.h @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef scoped_ptrs_util_h__ +#define scoped_ptrs_util_h__ + +#include +#include "pkcs11uri.h" +#include "secoid.h" + +struct ScopedDelete { + void operator()(SECAlgorithmID* id) { SECOID_DestroyAlgorithmID(id, true); } + void operator()(SECItem* item) { SECITEM_FreeItem(item, true); } + void operator()(PK11URI* uri) { PK11URI_DestroyURI(uri); } + void operator()(PLArenaPool* arena) { PORT_FreeArena(arena, PR_FALSE); } +}; + +template +struct ScopedMaybeDelete { + void operator()(T* ptr) { + if (ptr) { + ScopedDelete del; + del(ptr); + } + } +}; + +#define SCOPED(x) typedef std::unique_ptr > Scoped##x + +SCOPED(SECAlgorithmID); +SCOPED(SECItem); +SCOPED(PK11URI); + +#undef SCOPED + +#endif // scoped_ptrs_util_h__ -- cgit v1.2.1 From 5547c08ead42d757c383dcc8f55537cf571433ee Mon Sep 17 00:00:00 2001 From: Franziskus Kiefer Date: Tue, 27 Jun 2017 11:51:47 -0700 Subject: Bug 1376520 - some static analysis (infer) fixes, r=ttaubert Differential Revision: https://nss-review.dev.mozaws.net/D354 --- cpputil/dummy_io.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cpputil') diff --git a/cpputil/dummy_io.cc b/cpputil/dummy_io.cc index a8dacedbe..ef45db833 100644 --- a/cpputil/dummy_io.cc +++ b/cpputil/dummy_io.cc @@ -19,6 +19,10 @@ extern const struct PRIOMethods DummyMethodsForward; ScopedPRFileDesc DummyIOLayerMethods::CreateFD(PRDescIdentity id, DummyIOLayerMethods *methods) { ScopedPRFileDesc fd(PR_CreateIOLayerStub(id, &DummyMethodsForward)); + assert(fd); + if (!fd) { + return nullptr; + } fd->secret = reinterpret_cast(methods); return fd; } -- cgit v1.2.1