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

Fix GCC warning: forbidden conversion to char* #389

Merged
merged 4 commits into from
Nov 3, 2022

Conversation

plexoos
Copy link
Member

@plexoos plexoos commented Aug 30, 2022

GCC 11
warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

GCC 485
warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

See #392 for motivation

@plexoos plexoos force-pushed the pr/fix_warnings branch 10 times, most recently from d0fce01 to 5b5f3f3 Compare September 3, 2022 18:12
Copy link
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

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

Diff LGTM

@plexoos
Copy link
Member Author

plexoos commented Sep 3, 2022

Thanks @veprbl @akioogawa It is still a WIP though.
With the fixes in this PR the number of the targeted warnings went down but there is still a lot more to take care of.

--- fix_warns_orig.out  2022-09-03 18:33:15.000000000 -0400
+++ fix_warns_pr.out    2022-09-03 18:33:47.000000000 -0400
@@ -1,6 +1,6 @@
                                                                       msg  count
-0         deprecated conversion from string constant to [-Wwrite-strings]    798
+0         deprecated conversion from string constant to [-Wwrite-strings]    439
 1      may be used uninitialized in this function [-Wmaybe-uninitialized]    425
 2   deleting object of polymorphic class type which has non-virtual de...    403
 3                   variable set but not used [-Wunused-but-set-variable]    341
 4                                     unused variable [-Wunused-variable]    293

@plexoos plexoos force-pushed the pr/fix_warnings branch 3 times, most recently from 0b31427 to 11bd71e Compare September 7, 2022 00:30
@plexoos plexoos added the help wanted Extra attention is needed label Sep 7, 2022
@plexoos plexoos force-pushed the pr/fix_warnings branch 6 times, most recently from 70b288c to 346e9bf Compare September 9, 2022 16:09
@plexoos plexoos added this to the SL22d milestone Sep 9, 2022
@plexoos plexoos force-pushed the pr/fix_warnings branch 2 times, most recently from f3f8ff2 to a618004 Compare September 9, 2022 18:50
@plexoos plexoos marked this pull request as ready for review September 12, 2022 01:13
@plexoos plexoos requested a review from veprbl September 12, 2022 01:14
@plexoos plexoos removed the help wanted Extra attention is needed label Sep 12, 2022
@plexoos
Copy link
Member Author

plexoos commented Sep 13, 2022

At least these are gone

fix_warns_root5

 msg_id                                                                                                                                    msg
      0                                                                        deprecated conversion from string constant to [-Wwrite-strings]
...

fix_warns_root6

 msg_id                                                                                                                                    msg
...
     16                                                                                               defined but not used [-Wunused-variable]
...
     22                                                                                    too many arguments for format [-Wformat-extra-args]
...

Copy link
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

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

Good to merge

@plexoos
Copy link
Member Author

plexoos commented Sep 19, 2022

@jml985 @tonko-lj I would like to hear your comments as most of the warnings come from your code in StRoot/RTS/ and OnlTools/

@jml985
Copy link
Contributor

jml985 commented Sep 19, 2022

There are seem to be three areas here:

  1. OnlTools/OnlinePlots --- Nobody cares about these. These were the "Panitkin Plots" that have not been used since 2012 or so.
  2. OnlTools/Jevp --- These are mostly my code but run under a close-to-standard offline environment and if they compile they are probably just fine. I'd prefer if you just tell me what you want changed so I can do it, but updating the git directly probably won't cause any harm.
  3. StRoot/RTS --- These are the DAQ code we share with offline. Git is not the primary source, so changing it here is just a source of confusion. The code has to work with old VXWORKS compilers so please contact me or Tonko if you want changes made here.

@plexoos
Copy link
Member Author

plexoos commented Sep 23, 2022

From the private communication:

On 9/21/22 10:32 AM, Landgraf, Jeffery M. wrote:

Sounds good.

-Jeff

Hi Jeff,

let's not step on each other so I propose I deal with
the DETs (e.g. the DAQ_XXX subdirs) & RTS_EXAMPLE directory,
none which should be used in vxWorks, right?

And you deal with the rest (include files), for now at least?

-- Tonko

On Tue, Sep 20, 2022 at 6:44 PM Landgraf, Jeffery M. wrote:

Ok, I'll check them. Most likely I can do this friday.

-Jeff

Hello,

yeah, I'm also irritated and it is not that hard to change on my end.
I've been pruning my stuff with time. But I also don't know what happens
with vxWorks since I don't use it much anymore.

Jeff, how about you change one/few file to "const char *" and see what happens with
vxWorks? I'm betting it will be fine but...

-- Tonko

plexoos added a commit to plexoos/star-sw that referenced this pull request Sep 26, 2022
This code is not used and can be removed. See the comment at
star-bnl#389 (comment)
plexoos added a commit to plexoos/star-sw that referenced this pull request Sep 26, 2022
This code is not used and can be removed. See the comment at
star-bnl#389 (comment)
plexoos added a commit that referenced this pull request Sep 26, 2022
This code is not used and can be removed. See the comment at
#389 (comment)
plexoos and others added 4 commits October 31, 2022 21:14
GCC 11
warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

GCC 485
warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
The maintainers of StRoot/RTS forbid to modify this code.
@plexoos
Copy link
Member Author

plexoos commented Nov 2, 2022

Last call for the code owners to comment or approve

@plexoos plexoos merged commit e48dc9d into star-bnl:main Nov 3, 2022
@plexoos plexoos deleted the pr/fix_warnings branch November 3, 2022 22:22
@plexoos plexoos modified the milestones: SL22d, SL23a Jan 4, 2023
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.

8 participants