Browse Source

Fix multiple compile errors on older gcc versions

tags/2021-05-28
hogliux 9 years ago
parent
commit
cf39ad4b02
15 changed files with 104 additions and 66 deletions
  1. +8
    -8
      examples/Demo/Source/MainWindow.cpp
  2. +3
    -0
      examples/Demo/Source/MainWindow.h
  3. +11
    -6
      modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp
  4. +8
    -5
      modules/juce_audio_formats/codecs/flac/alloc.h
  5. +4
    -1
      modules/juce_audio_formats/codecs/flac/assert.h
  6. +4
    -1
      modules/juce_audio_formats/codecs/flac/callback.h
  7. +0
    -33
      modules/juce_audio_formats/codecs/flac/compat.h
  8. +3
    -1
      modules/juce_audio_formats/codecs/flac/endswap.h
  9. +0
    -1
      modules/juce_audio_formats/codecs/flac/metadata.h
  10. +0
    -1
      modules/juce_audio_formats/codecs/flac/stream_decoder.h
  11. +0
    -1
      modules/juce_audio_formats/codecs/flac/stream_encoder.h
  12. +0
    -5
      modules/juce_audio_formats/codecs/flac/win_utf8_io.h
  13. +61
    -1
      modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp
  14. +1
    -1
      modules/juce_box2d/box2d/Dynamics/Contacts/b2Contact.h
  15. +1
    -1
      modules/juce_core/system/juce_CompilerSupport.h

+ 8
- 8
examples/Demo/Source/MainWindow.cpp View File

@@ -22,6 +22,7 @@
==============================================================================
*/
#include <typeinfo>
#include "JuceDemoHeader.h"
//==============================================================================
@@ -558,19 +559,18 @@ AudioDeviceManager& MainAppWindow::getSharedAudioDeviceManager()
if (sharedAudioDeviceManager == nullptr)
{
sharedAudioDeviceManager = new AudioDeviceManager();
RuntimePermissions::request (
RuntimePermissions::recordAudio,
[] (bool wasGranted) {
int numInputChannels = wasGranted ? 2 : 0;
sharedAudioDeviceManager->initialise (numInputChannels, 2, nullptr, true, String(), nullptr);
}
);
RuntimePermissions::request (RuntimePermissions::recordAudio, runtimPermissionsCallback);
}
return *sharedAudioDeviceManager;
}
void MainAppWindow::runtimPermissionsCallback (bool wasGranted)
{
int numInputChannels = wasGranted ? 2 : 0;
sharedAudioDeviceManager->initialise (numInputChannels, 2, nullptr, true, String(), nullptr);
}
MainAppWindow* MainAppWindow::getMainAppWindow()
{
for (int i = TopLevelWindow::getNumTopLevelWindows(); --i >= 0;)


+ 3
- 0
examples/Demo/Source/MainWindow.h View File

@@ -93,6 +93,9 @@ public:
};
private:
static void runtimPermissionsCallback (bool wasGranted);
ScopedPointer<ContentComponent> contentComponent;
ScopedPointer<Component> taskbarIcon;
ScopedPointer<BubbleMessageComponent> currentBubbleMessage;


+ 11
- 6
modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp View File

@@ -204,10 +204,11 @@ namespace FloatVectorHelpers
typedef float Type;
typedef float32x4_t ParallelType;
typedef uint32x4_t IntegerType;
union signMaskUnion { ParallelType f; IntegerType i; };
enum { numParallel = 4 };
static forcedinline IntegerType toint (ParallelType v) noexcept { union { ParallelType f; IntegerType i; } u; u.f = v; return u.i; }
static forcedinline ParallelType toflt (IntegerType v) noexcept { union { ParallelType f; IntegerType i; } u; u.i = v; return u.f; }
static forcedinline IntegerType toint (ParallelType v) noexcept { signMaskUnion u; u.f = v; return u.i; }
static forcedinline ParallelType toflt (IntegerType v) noexcept { signMaskUnion u; u.i = v; return u.f; }
static forcedinline ParallelType load1 (Type v) noexcept { return vld1q_dup_f32 (&v); }
static forcedinline ParallelType loadA (const Type* v) noexcept { return vld1q_f32 (v); }
@@ -235,10 +236,11 @@ namespace FloatVectorHelpers
typedef double Type;
typedef double ParallelType;
typedef uint64 IntegerType;
union signMaskUnion { ParallelType f; IntegerType i; };
enum { numParallel = 1 };
static forcedinline IntegerType toint (ParallelType v) noexcept { union { ParallelType f; IntegerType i; } u; u.f = v; return u.i; }
static forcedinline ParallelType toflt (IntegerType v) noexcept { union { ParallelType f; IntegerType i; } u; u.i = v; return u.f; }
static forcedinline IntegerType toint (ParallelType v) noexcept { signMaskUnion u; u.f = v; return u.i; }
static forcedinline ParallelType toflt (IntegerType v) noexcept { signMaskUnion u; u.i = v; return u.f; }
static forcedinline ParallelType load1 (Type v) noexcept { return v; }
static forcedinline ParallelType loadA (const Type* v) noexcept { return *v; }
@@ -346,6 +348,9 @@ namespace FloatVectorHelpers
#define JUCE_LOAD_SRC1_SRC2_DEST(src1Load, src2Load, dstLoad) const Mode::ParallelType d = dstLoad (dest), s1 = src1Load (src1), s2 = src2Load (src2);
#define JUCE_LOAD_SRC_DEST(srcLoad, dstLoad) const Mode::ParallelType d = dstLoad (dest), s = srcLoad (src);
union signMask32 { float f; uint32 i; };
union signMask64 { double d; uint64 i; };
#if JUCE_USE_SSE_INTRINSICS || JUCE_USE_ARM_NEON
template<int typeSize> struct ModeType { typedef BasicOps32 Mode; };
template<> struct ModeType<8> { typedef BasicOps64 Mode; };
@@ -806,7 +811,7 @@ void FloatVectorOperations::abs (float* dest, const float* src, int num) noexcep
#if JUCE_USE_VDSP_FRAMEWORK
vDSP_vabs ((float*) src, 1, dest, 1, (vDSP_Length) num);
#else
union { float f; uint32 i; } signMask;
FloatVectorHelpers::signMask32 signMask;
signMask.i = 0x7fffffffUL;
JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = fabsf (src[i]), Mode::bit_and (s, mask),
JUCE_LOAD_SRC, JUCE_INCREMENT_SRC_DEST,
@@ -821,7 +826,7 @@ void FloatVectorOperations::abs (double* dest, const double* src, int num) noexc
#if JUCE_USE_VDSP_FRAMEWORK
vDSP_vabsD ((double*) src, 1, dest, 1, (vDSP_Length) num);
#else
union {double d; uint64 i;} signMask;
FloatVectorHelpers::signMask64 signMask;
signMask.i = 0x7fffffffffffffffULL;
JUCE_PERFORM_VEC_OP_SRC_DEST (dest[i] = fabs (src[i]), Mode::bit_and (s, mask),


+ 8
- 5
modules/juce_audio_formats/codecs/flac/alloc.h View File

@@ -41,11 +41,14 @@
* before #including this file, otherwise SIZE_MAX might not be defined
*/
#include <limits.h> /* for SIZE_MAX */
#if HAVE_STDINT_H
#include <stdint.h> /* for SIZE_MAX in case limits.h didn't get it */
#endif
#include <stdlib.h> /* for size_t, malloc(), etc */
// JUCE: removed as JUCE already includes standard headers and including
// these in FlacNamespace will cause problems
//#include <limits.h> /* for SIZE_MAX */
//#if HAVE_STDINT_H
//#include <stdint.h> /* for SIZE_MAX in case limits.h didn't get it */
//#endif
//#include <stdlib.h> /* for size_t, malloc(), etc */
#include "compat.h"
#ifndef SIZE_MAX


+ 4
- 1
modules/juce_audio_formats/codecs/flac/assert.h View File

@@ -35,7 +35,10 @@
/* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */
#ifdef DEBUG
#include <assert.h>
// JUCE: removed as JUCE already includes standard headers and including
// these in FlacNamespace will cause problems
//#include <assert.h>
#define FLAC__ASSERT(x) assert(x)
#define FLAC__ASSERT_DECLARATION(x) x
#else


+ 4
- 1
modules/juce_audio_formats/codecs/flac/callback.h View File

@@ -34,7 +34,10 @@
#define FLAC__CALLBACK_H
#include "ordinals.h"
#include <stdlib.h> /* for size_t */
// JUCE: removed as JUCE already includes this and including stdlib
// in FlacNamespace will cause problems
//#include <stdlib.h>
/** \file include/FLAC/callback.h
*


+ 0
- 33
modules/juce_audio_formats/codecs/flac/compat.h View File

@@ -39,15 +39,7 @@
#ifndef FLAC__SHARE__COMPAT_H
#define FLAC__SHARE__COMPAT_H
#if defined _WIN32 && !defined __CYGWIN__
/* where MSVC puts unlink() */
# include <io.h>
#else
# include <unistd.h>
#endif
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
#include <sys/types.h> /* for off_t */
#define FLAC__off_t __int64 /* use this instead of off_t to fix the 2 GB limit */
#if !defined __MINGW32__
#define fseeko _fseeki64
@@ -62,11 +54,6 @@
#define FLAC__off_t off_t
#endif
#if HAVE_INTTYPES_H
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#endif
#if defined(_MSC_VER)
#define strtoll _strtoi64
#define strtoull _strtoui64
@@ -95,33 +82,13 @@
#define FLAC__STRNCASECMP strncasecmp
#endif
#if defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ || defined __EMX__
#include <io.h> /* for _setmode(), chmod() */
#include <fcntl.h> /* for _O_BINARY */
#else
#include <unistd.h> /* for chown(), unlink() */
#endif
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
#if defined __BORLANDC__
#include <utime.h> /* for utime() */
#else
#include <sys/utime.h> /* for utime() */
#endif
#else
#include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
#include <utime.h> /* for utime() */
#endif
#if defined _MSC_VER
# if _MSC_VER >= 1600
/* Visual Studio 2010 has decent C99 support */
# include <stdint.h>
# define PRIu64 "llu"
# define PRId64 "lld"
# define PRIx64 "llx"
# else
# include <limits.h>
# ifndef UINT32_MAX
# define UINT32_MAX _UI32_MAX
# endif


+ 3
- 1
modules/juce_audio_formats/codecs/flac/endswap.h View File

@@ -51,7 +51,9 @@ static inline unsigned short __builtin_bswap16(unsigned short a)
#elif defined HAVE_BYTESWAP_H /* Linux */
#include <byteswap.h>
// JUCE: removed as JUCE already includes standard headers and including
// these in FlacNamespace will cause problems
//#include <byteswap.h>
#define ENDSWAP_16(x) (bswap_16 (x))
#define ENDSWAP_32(x) (bswap_32 (x))


+ 0
- 1
modules/juce_audio_formats/codecs/flac/metadata.h View File

@@ -33,7 +33,6 @@
#ifndef FLAC__METADATA_H
#define FLAC__METADATA_H
#include <sys/types.h> /* for off_t */
#include "export.h"
#include "callback.h"
#include "format.h"


+ 0
- 1
modules/juce_audio_formats/codecs/flac/stream_decoder.h View File

@@ -33,7 +33,6 @@
#ifndef FLAC__STREAM_DECODER_H
#define FLAC__STREAM_DECODER_H
#include <stdio.h> /* for FILE */
#include "export.h"
#include "format.h"


+ 0
- 1
modules/juce_audio_formats/codecs/flac/stream_encoder.h View File

@@ -33,7 +33,6 @@
#ifndef FLAC__STREAM_ENCODER_H
#define FLAC__STREAM_ENCODER_H
#include <stdio.h> /* for FILE */
#include "export.h"
#include "format.h"
#include "stream_decoder.h"


+ 0
- 5
modules/juce_audio_formats/codecs/flac/win_utf8_io.h View File

@@ -38,11 +38,6 @@
extern "C" {
#endif
#include <stdio.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <windows.h>
int get_utf8_argv(int *argc, char ***argv);
int printf_utf8(const char *format, ...);


+ 61
- 1
modules/juce_audio_formats/codecs/juce_FlacAudioFormat.cpp View File

@@ -24,6 +24,66 @@
#if JUCE_USE_FLAC
}
#if defined _WIN32 && !defined __CYGWIN__
#include <io.h>
#else
#include <unistd.h>
#endif
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
#include <sys/types.h> /* for off_t */
#endif
#if HAVE_INTTYPES_H
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#endif
#if defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ || defined __EMX__
#include <io.h> /* for _setmode(), chmod() */
#include <fcntl.h> /* for _O_BINARY */
#else
#include <unistd.h> /* for chown(), unlink() */
#endif
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
#if defined __BORLANDC__
#include <utime.h> /* for utime() */
#else
#include <sys/utime.h> /* for utime() */
#endif
#else
#include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
#include <utime.h> /* for utime() */
#endif
#if defined _MSC_VER
#if _MSC_VER >= 1600
#include <stdint.h>
#else
#include <limits.h>
#endif
#endif
#ifdef _WIN32
#include <stdio.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <windows.h>
#endif
#ifdef DEBUG
#include <assert.h>
#endif
#include <stdlib.h>
#include <stdio.h>
namespace juce
{
namespace FlacNamespace
{
#if JUCE_INCLUDE_FLAC_CODE || ! defined (JUCE_INCLUDE_FLAC_CODE)
@@ -62,7 +122,7 @@ namespace FlacNamespace
#define FLAC__HAS_X86INTRIN 1
#endif
#undef __STDC_LIMIT_MACROS
#undef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#define flac_max jmax
#define flac_min jmin


+ 1
- 1
modules/juce_box2d/box2d/Dynamics/Contacts/b2Contact.h View File

@@ -239,7 +239,7 @@ inline void b2Contact::SetEnabled(bool flag)
}
else
{
m_flags &= ~e_enabledFlag;
m_flags &= ~((unsigned int) e_enabledFlag);
}
}


+ 1
- 1
modules/juce_core/system/juce_CompilerSupport.h View File

@@ -98,7 +98,7 @@
#define JUCE_COMPILER_SUPPORTS_STATIC_ASSERT 1
#endif
#ifndef JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL
#if __has_feature (cxx_override_control) && (! defined (JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL))
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#endif


Loading…
Cancel
Save