Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix the ability to compile coturn using C++ compiler#1546

Merged
ggarber merged 1 commit intocoturn:masterfrom
jonesmz:fix_cpp_compilation
May 25, 2025
Merged

Fix the ability to compile coturn using C++ compiler#1546
ggarber merged 1 commit intocoturn:masterfrom
jonesmz:fix_cpp_compilation

Conversation

@jonesmz
Copy link
Contributor

@jonesmz jonesmz commented Jul 29, 2024

This adjusts the code to allow compilation with a C++ compiler, but doesn't change the build to use a C++ compiler. Everything should continue working as-is with existing c-compilers. This is just a "let it work" change, not a "change how it works" change.

@jonesmz
Copy link
Contributor Author

jonesmz commented Jul 29, 2024

My proposal to switch to building coturn as a C++ codebase is here, for reference: #1416

It depends on this change.

@jonesmz
Copy link
Contributor Author

jonesmz commented Sep 23, 2024

@eakraly is this change thematically acceptable?

My work is planning to integrate with opentelemetry-sdk, which is a C++ (cmake build) package, and that's going to depend on this change to be able to function.

We'd rather not carry patches if upstream considers them acceptable.

@jonesmz
Copy link
Contributor Author

jonesmz commented Feb 13, 2025

@eakraly

@eakraly
Copy link
Collaborator

eakraly commented Feb 21, 2025

Hi @jonesmz ! Sorry I was unresponsive
This looks OK to me. Pls resolve the conflict and I will merge it.
Thanks!

@jonesmz jonesmz force-pushed the fix_cpp_compilation branch 4 times, most recently from de9cb9c to 06efbee Compare February 24, 2025 20:47
@jonesmz jonesmz force-pushed the fix_cpp_compilation branch from 06efbee to c6e6954 Compare February 24, 2025 20:58
@jonesmz
Copy link
Contributor Author

jonesmz commented Feb 24, 2025

@eakraly merge conflict resolved, CI is passing.

@jonesmz
Copy link
Contributor Author

jonesmz commented May 5, 2025

@eakraly sorry to be a nag... is there anything else you're looking for on this?

@jonesmz
Copy link
Contributor Author

jonesmz commented May 21, 2025

@ggarber are you open to taking a look at this PR? This PR is a dependency for the work my employer is doing with opentelemetry-sdk, it would be nice to reduce the difference between our fork of coturn and upstream.

@ggarber ggarber requested a review from Copilot May 25, 2025 08:49
@ggarber ggarber self-assigned this May 25, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes compilation issues when using a C++ compiler by adding necessary type casts and const qualifiers while preserving the original C functionality. The changes include:

  • Applying explicit casts to constants in min() calls in ns_turn_msg.c.
  • Refactoring header includes and C linkage blocks in prom_server.h.
  • Updating function signatures and header includes for const correctness and C++ compatibility in ns_turn_utils.h and ns_turn_utils.c.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/client/ns_turn_msg.c Added explicit casts in min() calls to resolve C++ type issues.
src/apps/relay/prom_server.h Cleaned up duplicated includes and adjusted C linkage blocks.
src/apps/common/ns_turn_utils.h Improved C++ compatibility with const correctness and modern min usage.
src/apps/common/ns_turn_utils.c Updated function signature for consistency with the header changes.

@ggarber
Copy link
Contributor

ggarber commented May 25, 2025

Thank you for the contribution @jonesmz . it looks reasonable to me.

In the future try to avoid changes unrelated to the goal of the PR (like indentation changes) in the same PR 🙏 But it is ok for this one.

@ggarber ggarber merged commit c37462b into coturn:master May 25, 2025
58 checks passed
@jonesmz
Copy link
Contributor Author

jonesmz commented May 25, 2025

Thanks for merging the change.

Can you help me understand what indentation changes you are referring to?

I originally opened this PR 11 months ago and don't recall any intentional indentation changes, neither do I see any on my mobile webbrowser when looking at the diff

Keep in mind that the linter rules of the project enforce the code style, so its possible any changes you are referring to are necessitated by that.

@jonesmz jonesmz deleted the fix_cpp_compilation branch May 25, 2025 17:34
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.

4 participants