1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-05 06:27:37 +00:00

audio/espeak-ng: fix build with clang 16

Since clang 16 (and gcc 11) the default C++ standard is now gnu++17.
Because audio/espeak-ng's Makefile does not explicitly set its C++
standard, this leads to an error:

  src/speechPlayer/src/speechWaveGenerator.cpp:197:56: error: reference to 'sample' is ambiguous
          unsigned int generate(const unsigned int sampleCount, sample* sampleBuf) {
                                                                ^
  src/speechPlayer/src/sample.h:23:3: note: candidate found by name lookup is 'sample'
  } sample;
    ^
  /usr/include/c++/v1/__algorithm/sample.h:95:17: note: candidate found by name lookup is 'std::sample'
  _SampleIterator sample(_PopulationIterator __first,
                  ^

This is because speechWaveGenerator.cpp has "using namespace std;" at
the top, so "sample" can match both "std::sample" (from <algorithm>) and
"struct sample" (from sample.h). Qualify "sample" as "::sample" to work
around the problem.

PR:		271486
Approved by:	maintainer timeout (2 weeks)
MFH:		2023Q2
This commit is contained in:
Dimitry Andric 2023-05-18 14:09:48 +02:00
parent 28b30b0f68
commit c7753b07bb
2 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,6 @@
PORTNAME= espeak-ng
PORTVERSION= 1.51.1
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= audio
#MASTER_SITES= https://github.com/espeak-ng/${PORTNAME}/releases/download/${PORTVERSION}/

View File

@ -0,0 +1,11 @@
--- src/speechPlayer/src/speechWaveGenerator.cpp.orig 2022-06-21 14:53:53 UTC
+++ src/speechPlayer/src/speechWaveGenerator.cpp
@@ -194,7 +194,7 @@ class SpeechWaveGeneratorImpl: public SpeechWaveGenera
SpeechWaveGeneratorImpl(int sr): sampleRate(sr), voiceGenerator(sr), fricGenerator(), cascade(sr), parallel(sr), frameManager(NULL) {
}
- unsigned int generate(const unsigned int sampleCount, sample* sampleBuf) {
+ unsigned int generate(const unsigned int sampleCount, ::sample* sampleBuf) {
if(!frameManager) return 0;
double val=0;
for(unsigned int i=0;i<sampleCount;++i) {