Skip to content

Commit

Permalink
Tag some functions unused to suppress warnings.
Browse files Browse the repository at this point in the history
(Internal change: 1970935)
  • Loading branch information
c64kernal authored and pixar-oss committed May 17, 2019
1 parent 2bf2ef1 commit bde02df
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pxr/base/lib/arch/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@ PXR_NAMESPACE_OPEN_SCOPE
/// \hideinitializer
# define ARCH_UNUSED_ARG

/// Macro used to indicate a function may be unused.
///
/// In general, avoid this attribute if possible. Mostly this attribute
/// should be used when you need to keep a function around (for some
/// good reason), but it is not used in the rest of the code. The usage
/// is:
/// \code
/// ARCH_UNUSED_FUNCTION void Func() {
/// ...
/// }
/// \endcode
///
/// \hideinitializer
# define ARCH_UNUSED_FUNCTION

/// Macro used to indicate that a function's code must always be emitted even
/// if not required.
///
Expand Down Expand Up @@ -154,6 +169,7 @@ PXR_NAMESPACE_OPEN_SCOPE
__attribute__((format(scanf, _fmt, _firstArg)))
# define ARCH_NOINLINE __attribute__((noinline))
# define ARCH_UNUSED_ARG __attribute__ ((unused))
# define ARCH_UNUSED_FUNCTION __attribute__((unused))
# define ARCH_USED_FUNCTION __attribute__((used))

#elif defined(ARCH_COMPILER_MSVC)
Expand All @@ -162,6 +178,7 @@ PXR_NAMESPACE_OPEN_SCOPE
# define ARCH_SCANF_FUNCTION(_fmt, _firstArg)
# define ARCH_NOINLINE // __declspec(noinline)
# define ARCH_UNUSED_ARG
# define ARCH_UNUSED_FUNCTION
# define ARCH_USED_FUNCTION

#else
Expand Down
4 changes: 4 additions & 0 deletions pxr/base/lib/arch/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
//

#include "pxr/pxr.h"
#include "pxr/base/arch/attributes.h"
#include "pxr/base/arch/hash.h"

//
Expand Down Expand Up @@ -106,13 +107,15 @@ class SpookyHash
//
// Init: initialize the context of a SpookyHash
//
ARCH_UNUSED_FUNCTION
void Init(
uint64 seed1, // any 64-bit value will do, including 0
uint64 seed2); // different seeds produce independent hashes

//
// Update: add a piece of a message to a SpookyHash state
//
ARCH_UNUSED_FUNCTION
void Update(
const void *message, // message fragment
size_t length); // length of message fragment in bytes
Expand All @@ -126,6 +129,7 @@ class SpookyHash
// The result is the same as if SpookyHash() had been called with
// all the pieces concatenated into one message.
//
ARCH_UNUSED_FUNCTION
void Final(
uint64 *hash1, // out only: first 64 bits of hash value.
uint64 *hash2); // out only: second 64 bits of hash value.
Expand Down

0 comments on commit bde02df

Please sign in to comment.