-
Notifications
You must be signed in to change notification settings - Fork 761
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
Create constants for messages.conf and simplify switch job name switches #3265
Conversation
In almost all lines like this |
I was trying to make it more explicit so it doesn't hide too much info and gets confusing. Those were my motivations:
In my opinion X-macros are not too clear by default, but they do save a lot of code, so I am afraid of changing it like that and it becoming confusing. But I can change if it is preferred to save those repetitions in the declaration. |
I think one macro is ok, but probably better remove prefix |
Ok. I still think it is adding unneeded abstraction, but it is much better than completely hiding them as the initial proposal. I am ok with this :) I will update the PR to remove MSGTBL_ prefix |
bce3420
to
596c20d
Compare
596c20d
to
f8a6d12
Compare
Pull Request Prelude
Changes Proposed
1. Enum for messages.conf
Replacing the hardcoded numbers in source for
conf/messages.conf
entries with a enum.This is meant to ease the readability a bit with constants that we can understand instead of numbers + comments.
I did not perform any check whether there are unused message entries (Although I do think there are).
I am open for suggestions about naming. Naming 1000+ entries in one go is very hard, so some stuff may have slipped with not so good names.
Huge thanks to @TioAkima who helped me naming all those enum entries.
For people upgrading their copies
common/msgtable.h
, you can either add more items in there OR override it using a define:--
2. Using XMacro for JobID => Job Name conversions
I took the chance to also update the 2 functions in source that converts job ID to name. They had a hardcoded switch/case + message id, and I replaced both with XMacro using the
class*.h
files (as it is done in a few other places). This should help prevent desynchronization in the future.Still about desynchronization, there were a few values missing in both functions, and with this PR these values are now correctly mapped.
I made a small plugin to dump all the values into the terminal, and it may be found here:
https://github.com/guilherme-gm/Hercules-releases/tree/master/PR%20Extras/PR%203265%20-%20messages%20conf%20enum/
It dumps the list of jobID => jobName so we can compare with comparison tools. A dump of master vs this PR is also available here: https://github.com/guilherme-gm/Hercules-releases/tree/master/PR%20Extras/PR%203265%20-%20messages%20conf%20enum/jobname_dump
For people upgrading their copies
If you have custom jobs, you may need to update the enum macros in
src/common/class.h
,src/common/class_special.h
andsrc/common/class_hidden.h
to include the message ID of your jobs.Issues addressed:
Helps #165 (DON'T SOLVE IT)