posemath: drop the dead knobs and give it its own directory - #4387
Open
grandixximo wants to merge 2 commits into
Open
posemath: drop the dead knobs and give it its own directory#4387grandixximo wants to merge 2 commits into
grandixximo wants to merge 2 commits into
Conversation
BsAtHome
reviewed
Aug 16, 2026
Contributor
Author
|
Need me to rebase here? I have the follow up ready, do we need to run this trough weekly meeting? |
BsAtHome
reviewed
Aug 17, 2026
Contributor
|
Rebase would be nice to see if there is any change that altered behaviour. |
posemath.h carries four switches that have only ever had one setting, and
they hide what the declarations actually say.
USE_CONST, USE_CCONST and USE_REF are defined unconditionally a few lines
above the blocks that test them, so PM_CONST and PM_CCONST are always
const and PM_REF is always a reference. Spelling them out turns
declarations like
PM_CARTESIAN(PM_CONST PM_SPHERICAL PM_REF s);
into what they have always meant:
PM_CARTESIAN(const PM_SPHERICAL & s);
INCLUDE_POSEMATH_COPY_CONSTRUCTORS is guarded by __cplusplus < 201103L, so
it is never defined in a tree built as C++20. The comment beside it
already explains that the compiler generates better copy constructors than
the ones it hides, and every one of them has been dead code since the move
to C++11.
PM_LOOSE_NAMESPACE would typedef VECTOR, MATRIX, POSE and friends into the
global namespace. Nothing defines it.
The remaining #if 0 blocks go too: the norm() declarations and their
definitions, and a note about a call being ambiguous on g++ 2.8 and 2.9.
The deliberate poison macro for pmCartNorm() stays, since it is there to
turn a use into a compile error rather than to be compiled out.
No behaviour change: the preprocessor already resolved all of this the same
way on every build.
posemath is not part of NML and never has been. It includes nothing from libnml, uses none of its types, and builds into its own shared library, libposemath.so. The only edge between them runs the other way: cms_pm.cc includes <posemath.h> to serialise the classes. Sitting inside libnml/ made it look like an NML component, which is misleading for anyone reading the tree and awkward for anything that wants to depend on the maths without the messaging. Pure move. The files are unchanged, and what follows is the paths that named the old location: the Submakefile's own prefixes, the SRCHEADERS entries and per-module object lists in src/Makefile, the two USE_TOPDIR includes in tpcomp.comp, and the copyright stanza in debian/. SUBDIRS gains libposemath as an entry of its own rather than one buried in the libnml group, since that grouping was the thing being corrected.
grandixximo
force-pushed
the
posemath-cleanup
branch
from
August 17, 2026 12:14
8321b18 to
ff925d4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following on from the review discussion in #4375, where the posemath headers came up and the answer was that the code has been misplaced in libnml for some time. This is the first two steps of the five I sketched there, and the two that stand on their own.
A. Drop the knobs that are never turned.
USE_CONST,USE_CCONSTandUSE_REFare defined unconditionally at the top of the header and selectPM_CONST,PM_CCONSTandPM_REF. Every declaration in the file is written through that indirection, so reading a signature means resolving three macros to find out that they meanconst,constand&. The macros are substituted out.INCLUDE_POSEMATH_COPY_CONSTRUCTORSis guarded by#if __cplusplus < 201103L, and the tree builds as C++20, so its 13 blocks in each file have not been compiled in a long time.PM_LOOSE_NAMESPACEis defined nowhere. Four#if 0blocks go with them.What stays is the one deliberate poison macro for
pmCartNorm(), which exists to make a use fail to compile rather than to be compiled out.No behaviour change: the preprocessor already resolved every one of these the same way on every build in the tree. 338 lines out, 50 in.
B. Move it out of libnml.
git mv src/libnml/posemath src/libposemath. posemath includes nothing from NML and uses nothing from it; the only edge between them runs the other way, incms_pm.cc. The move is the sources plus the paths that named the old location: the Submakefile prefixes,SRCHEADERSand the per-module object lists insrc/Makefile, twoUSE_TOPDIRincludes intpcomp.comp, and thedebian/copyrightstanza.libposemathgets its ownSUBDIRSentry rather than one buried in the libnml group. All eight source files are detected as pure renames.Testing.
Configured
--with-realtime=uspaceand built clean, no errors and no warnings.libposemath.so.0exports the same 390 symbols before and after, byte identical lists fromnm -D --defined-only. That is the evidence that A changes nothing: it is a large diff that the compiler cannot tell apart from the original.include/holds the same 38 headers with the same names, so the installed surface is untouched by the move.scripts/runtestsover blendmath, realtime-math, interp, ccomp and matrixkins: 90 run, 90 successful, 0 failed, 1 skipped, 0 shmem errors.All nine kinematics modules that link a posemath object load under
halrun: genser, scara, puma, genhex, penta, 5axis, three21, rotarydelta, triv.What comes next, separately.
C splits the header by language behind the existing umbrella, D folds
emcpos.handemcpose.hinto one header beside posemath, and E takesgomath.h,gotypes.handsincos.hoff the exported list. Those are written and tested but want their own review, since each changes what the tree installs.