Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove or replace old-style casts that cast away constness #271

Merged

Conversation

wmtan
Copy link
Contributor

@wmtan wmtan commented Aug 9, 2013

Ono of the impediments to thread safety is casting away constness. Old style casts that do this are especially bad because they are harder to find than const_cast.
I ran the clang static analyzer on all the framework code minus the unit tests. All occurrences of old-style casts that cast away constness were in a single package, IOPool/Streamer.
This pull request makes very simple changes to remove or replace those casts. In most cases, casting away constness was not needed, and the cast was removed or modified so that it no longer casts away constness.
In the places where it was not trivial to remove the casting away constness, a const_cast is now used to cast away constness, so no old style cast still does.
In a very few cases, some old style casts that did not remove constness were removed or replaced by C++ casts.

@ktf
Copy link
Contributor

ktf commented Aug 9, 2013

@nclopezo please test.

@ghost ghost assigned nclopezo Aug 9, 2013
@nclopezo
Copy link
Contributor

nclopezo commented Aug 9, 2013

Hi

I tested this one with CMSSW_7_0_X_2013-08-09-0200, all tests passed. You can see the logs for the build, the unit tests and the RelVals here:

https://cmssdt.cern.ch/jenkins/job/Pull-Request-Integration/ARCHITECTURE=slc5_amd64_gcc472/78/console

@cmsbuild
Copy link
Contributor

cmsbuild commented Aug 9, 2013

The following categories have been signed by chrjones (a.k.a. @Dr15Jones on GitHub): Core

@cms-git-visualization, @cms-git-core, @cms-git-geometry

ktf added a commit that referenced this pull request Aug 9, 2013
…stness

Remove or replace old-style casts that cast away constness
@ktf ktf merged commit 898f289 into cms-sw:CMSSW_7_0_X Aug 9, 2013
@wmtan wmtan deleted the removeOldStyleCastsThatCastAwayConstness branch August 9, 2013 16:47
makortel pushed a commit to makortel/cmssw that referenced this pull request Apr 22, 2015
Add elasticsearch templates for our logs.
jbueghly pushed a commit to NWUHEP/cmssw that referenced this pull request Feb 26, 2019
[Backport 10_4_0] Fix thicknessIndex for trigger cells
abaty pushed a commit to abaty/cmssw that referenced this pull request Apr 1, 2020
…sw#271)

Co-authored-by: Andre Govinda Stahl Leiton <andre.govinda.stahl.leiton@cern.ch>
slava77 pushed a commit to slava77/cmssw that referenced this pull request Oct 9, 2021
UBParker pushed a commit to UBParker/cmssw that referenced this pull request Apr 20, 2024
* Fix inventStubs bug in duplicate removal

When using L2L3D1 seeds, it is only L2L3 that are used to determined the r-z helix params, not L2D1 as the code currently assumes.

* Update PurgeDuplicate.cc

* add comment

* formatted
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.

None yet

4 participants