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 unused 3rd parameter for AZ_CLASS_ALLOCATOR. #14530

Merged
merged 1 commit into from
Feb 21, 2023

Conversation

Jackie9527
Copy link
Contributor

Signed-off-by: Jackie9527 80555200+Jackie9527@users.noreply.github.com

What does this PR do?

The 3rd parameter of AZ_CLASS_ALLOCATOR is useless, which could be misleading.

The old style as follows:

AZ_CLASS_ALLOCATOR(AutomatedTestingModule, AZ::SystemAllocator, 0);

Here is recommended:

AZ_CLASS_ALLOCATOR(AutomatedTestingModule, AZ::SystemAllocator);

How was this PR tested?

Verified by running UT cases, such as:
remove-unused-3rd-param-01
remove-unused-3rd-param-02
remove-unused-3rd-param-03
remove-unused-3rd-param-04
remove-unused-3rd-param-05
remove-unused-3rd-param-06

@Jackie9527 Jackie9527 requested review from a team as code owners February 10, 2023 12:36
Copy link
Contributor

@burelc-amzn burelc-amzn left a comment

Choose a reason for hiding this comment

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

Thanks so much for this!

@nick-l-o3de
Copy link
Contributor

nick-l-o3de commented Feb 10, 2023

Won't this break all 3rd party contributor / partner gems? We try to avoid doing this. (Is there a way to make the old macro still work?)

@lemonade-dm
Copy link
Contributor

@Jackie9527 Can you post the script or command you used to perform the replacement?

@mbalfour-amzn
Copy link
Contributor

Won't this break all 3rd party contributor / partner gems? We try to avoid doing this. (Is there a way to make the old macro still work?)

I don't see a change to the macro definition itself in Memory.h, so I think this is just changing all the engine uses of the macro, not the macro itself?

@nick-l-o3de
Copy link
Contributor

nick-l-o3de commented Feb 10, 2023

I hope all the folks shipping this did the same check as I did, but I checked out that repo, added an old style allocator (with the ,0) to it, ensured it still worked. Then I also did a

git diff dc444c414 | grep -v -i CLASS_ALLOCATOR | grep -i "+++"

to ensure that there were no other changes except for changes to class allocator lines.

Confirmed. Shipit.

@spham-amzn
Copy link
Contributor

I hope all the folks shipping this did the same check as I did, but I checked out that repo, added an old style allocator (with the ,0) to it, ensured it still worked. Then I also did a

git diff dc444c414 | grep -v -i CLASS_ALLOCATOR | grep -i "+++"

to ensure that there were no other changes except for changes to class allocator lines.

Confirmed. Shipit.

Very Unix-y! I like it

@Jackie9527
Copy link
Contributor Author

@Jackie9527 Can you post the script or command you used to perform the replacement?

I used VSCode to search, check and replace.
The key word is Allocator, 0), which is replaced to Allocator).

@lemonade-dm
Copy link
Contributor

lemonade-dm commented Feb 11, 2023

@Jackie9527 Can you post the script or command you used to perform the replacement?

I used VSCode to search, check and replace. The key word is Allocator, 0), which is replaced to Allocator).

Thanks for posting the command, I verified it the search only catches AZ_CLASS_ALLOCATOR lines using bash

$ find . \( -name "*.cpp" -o -name "*.h" -o -name "*.hxx" \) -exec grep -F "Allocator, 0)" {} \; > allocator.txt
$ awk '{ $1=$1; print }' < allocator.txt | sort > sorted.txt

It takes a while to run, but it outputs a sorted file of lines. The output only contains with lines related to AZ_CLASS_ALLOCATOR*, so this is change is good.

Here is a file that contains the list records found by searching for the string "Allocator, 0)" sorted.txt

@Jackie9527 Jackie9527 force-pushed the remove-redundant-3rd-param branch from e2526f0 to f9812f5 Compare February 11, 2023 13:07
@AMZN-daimini
Copy link
Contributor

Hi there, automated review failed with some error, see report here:
https://jenkins.build.o3de.org/blue/organizations/jenkins/O3DE/detail/PR-14530/3/pipeline/531

You may also need to pull latest to resolve the conflicts that have arisen since last week.
Let me know when this is fixed and I can start AR again :)

@Jackie9527 Jackie9527 force-pushed the remove-redundant-3rd-param branch from f9812f5 to a46c9cc Compare February 21, 2023 01:30
Signed-off-by: Jackie9527 <80555200+Jackie9527@users.noreply.github.com>
@Jackie9527 Jackie9527 force-pushed the remove-redundant-3rd-param branch from a46c9cc to 80f264c Compare February 21, 2023 01:35
@Jackie9527
Copy link
Contributor Author

Hi there, automated review failed with some error, see report here: https://jenkins.build.o3de.org/blue/organizations/jenkins/O3DE/detail/PR-14530/3/pipeline/531

You may also need to pull latest to resolve the conflicts that have arisen since last week. Let me know when this is fixed and I can start AR again :)

done, the branch has been rebased using the latest commit [4f5259b].

@lemonade-dm
Copy link
Contributor

Hi there, automated review failed with some error, see report here: https://jenkins.build.o3de.org/blue/organizations/jenkins/O3DE/detail/PR-14530/3/pipeline/531
You may also need to pull latest to resolve the conflicts that have arisen since last week. Let me know when this is fixed and I can start AR again :)

done, the branch has been rebased using the latest commit [4f5259b].

Another build is in progress at https://jenkins.build.o3de.org/job/O3DE/job/PR-14530/

@Jackie9527
Copy link
Contributor Author

Hi there, automated review failed with some error, see report here: https://jenkins.build.o3de.org/blue/organizations/jenkins/O3DE/detail/PR-14530/3/pipeline/531

You may also need to pull latest to resolve the conflicts that have arisen since last week. Let me know when this is fixed and I can start AR again :)

Good news is that most of the testcases are passed, only one is failed.
Bad news is that I don't know how to fix that, because I have run AzCore.Tests successfully on my machine.
image

@lemonade-dm
Copy link
Contributor

Hi there, automated review failed with some error, see report here: https://jenkins.build.o3de.org/blue/organizations/jenkins/O3DE/detail/PR-14530/3/pipeline/531
You may also need to pull latest to resolve the conflicts that have arisen since last week. Let me know when this is fixed and I can start AR again :)

Good news is that most of the testcases are passed, only one is failed. Bad news is that I don't know how to fix that, because I have run AzCore.Tests successfully on my machine. image

The failure that occurred in the AzCore.Tests was in the Parallel_Thread.Test, which is currently unstable and there is a github issue to address it (#14536).
I have re-kicked off another build and it should pass this time.

@lemonade-dm lemonade-dm merged commit 152bc0a into o3de:development Feb 21, 2023
@Jackie9527 Jackie9527 deleted the remove-redundant-3rd-param branch February 22, 2023 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

9 participants