Skip to content

Fix macOS core build warnings (and bundled addons) - #8621

Open
danzeeeman wants to merge 2 commits into
openframeworks:masterfrom
danzeeeman:danm/osx/fix-warnings
Open

danzeeeman wants to merge 2 commits into
openframeworks:masterfrom
danzeeeman:danm/osx/fix-warnings

Conversation

@danzeeeman

Copy link
Copy Markdown
Member

Changes

Core (libs/openFrameworks)

  • ofEvents.cpp, ofFpsCounter.cpp: reorder constructor initializer lists to match member declaration order (-Wreorder-ctor).
  • ofColor.h: explicit static_cast in ofColor_::limit() (-Wimplicit-const-int-float-conversion). The value is unchanged.
  • ofPixels.cpp, ofFileUtils.cpp, ofAVFoundationVideoPlayer.m, ofAVEngineSoundPlayer.mm: remove unused variables and the unused natural() function. Variables only used in the iOS paths are marked [[maybe_unused]] so iOS builds are unaffected.
  • ofLog.h: scoped -Wformat-security suppression around ofVAArgsToString(), which deliberately forwards a caller-supplied printf format. Format semantics are preserved.
  • ofAVFoundationPlayer.mm, ofSystemUtils.cpp: scoped #pragma clang diagnostic ignored "-Wdeprecated-declarations" around the CVOpenGLTexture* and NSOpenGLContext calls. Core renders with OpenGL and there is no replacement, so only those calls are silenced.

Bundled addons

  • ofxOpenCv: using ofBaseDraws::draw; (ofxCvContourFinder) and using ofxCvImage::setRoiFromPixels; (ofxCvFloatImage) to fix hidden overloaded virtuals.
  • ofxAssimp: remove unused private field mOfTexType. bFinishedTransition is marked [[maybe_unused]] because it is referenced only in commented-out logging.
  • ofxSvg: remove unused local bFoundValidNextChar.

Behavior change: ofAVEngineSoundPlayer.mm

Four dispatch_time() calls passed float seconds (0.033f, 0.017f, 0.3f, 0.3f) where nanoseconds are expected. They were truncated to 0, so the "delayed" blocks ran on the next main-queue turn. They now use the intended delays (33 ms, 17 ms, 300 ms, 300 ms) via NSEC_PER_MSEC. This affects the audio interruption, restore-play-count and interrupted play() retry paths.

Dan Moore and others added 2 commits October 22, 2026 00:15
Clears the mechanical warnings reported by a clean `make Release` of
libs/openFrameworks on macOS (clang, -Wall). No behavior or API changes.

Core (libs/openFrameworks):
- ofEvents.cpp, ofFpsCounter.cpp: reorder constructor initializer lists
  to match member declaration order (-Wreorder-ctor).
- ofColor.h: explicit static_cast<float> in ofColor_::limit() for the
  integer specializations (-Wimplicit-const-int-float-conversion). The
  value is unchanged; the cast only makes the existing rounding explicit.
- ofPixels.cpp: remove unused local `bytesPerPixel`.
- ofFileUtils.cpp: remove unused static `natural()` comparator.
- ofLog.h: scope a -Wformat-security suppression around
  ofVAArgsToString(), which intentionally forwards a caller-supplied
  printf format. Existing format semantics are preserved.
- ofAVFoundationVideoPlayer.m: remove unused `currentSampleRate`.
- ofAVEngineSoundPlayer.mm: remove an unused `error` in init; mark
  variables that are only used in the iOS (#ifndef TARGET_OSX) paths
  as [[maybe_unused]] so iOS builds are unaffected.

Bundled addons:
- ofxOpenCv: add using-declarations (ofBaseDraws::draw in
  ofxCvContourFinder, ofxCvImage::setRoiFromPixels in ofxCvFloatImage)
  to stop hidden overloaded virtuals (-Woverloaded-virtual).
- ofxAssimp: remove unused private field mOfTexType; mark the
  set-but-unused bFinishedTransition [[maybe_unused]] (referenced only
  in commented-out logging).
- ofxSvg: remove unused local bFoundValidNextChar.

Intentionally not addressed here:
- -Wliteral-conversion in ofAVEngineSoundPlayer.mm (dispatch_time is
  given float seconds, so the delay is currently 0 ns); fixing it would
  change interruption timing.
- OpenGL deprecation warnings (CVOpenGLTexture*, NSOpenGLContext) in
  ofAVFoundationPlayer.mm and ofSystemUtils.cpp; no replacement exists
  while core renders with OpenGL.
- libs/utf8 and other external libraries.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…acOS

Finishes the macOS core warning cleanup started in the previous commit.
A clean `make Release` of libs/openFrameworks now reports no warnings
outside libs/utf8.

ofAVEngineSoundPlayer.mm: dispatch_time() takes a delta in nanoseconds
(int64_t), but four call sites passed float seconds (0.033f, 0.017f,
0.3f, 0.3f). The float was truncated to 0, so these "delayed" blocks
actually ran on the next main-queue turn (-Wliteral-conversion). They
now use the intended delays via NSEC_PER_MSEC:
  - 0.033f -> 33 * NSEC_PER_MSEC   (interruption handling)
  - 0.017f -> 17 * NSEC_PER_MSEC   (restore play count)
  - 0.3f   -> 300 * NSEC_PER_MSEC  (two play() retries while the
                                   session is interrupted / config
                                   change pending)
This is a real behavior change: these blocks are now actually deferred.
Audio interruption / route change / media-services-reset handling
should be exercised in the sound examples.

ofAVFoundationPlayer.mm, ofSystemUtils.cpp: the remaining
-Wdeprecated-declarations are Apple's OpenGL deprecations
(CVOpenGLTexture*, NSOpenGLContext). openFrameworks core renders with
OpenGL and there is no drop-in replacement, so wrap just those calls in
scoped `#pragma clang diagnostic push/ignored/pop` rather than disabling
the warning for the whole file or build.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@danoli3 danoli3 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will run some more analysis but yeah some changes unsure about. Generally ordering stuff is good! annoying warnings ive seen for too long.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cant remember why but this was important

}

//------------------------------------------------------------------------------------------------------------
static bool natural(const ofFile& a, const ofFile& b) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removed?

if (bSampleAudio) {
// really?
double preferredHardwareSampleRate = 44100;
double currentSampleRate = preferredHardwareSampleRate;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removed on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants