Skip to content

Drop TSRM_ASSERT macro #5562

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

Closed
wants to merge 1 commit into from
Closed

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented May 12, 2020

It is only used once, and because ZEND_DEBUG is always defined we were asserting even in non debug builds

@Girgias Girgias force-pushed the drop-tsrm-assert branch from 493100b to 71f8e9c Compare May 12, 2020 22:57
TSRM/TSRM.c Outdated
#else
# define TSRM_ASSERT
#endif
#include "Zend/zend_portability.h"
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit dirty, in that TSRM is not supposed to depend on Zend... Though that separation probably is not particularly important nowadays anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

We are already depending on ZEND_DEBUG, or should that be an #ifdef TSRM_DEBUG?

If we don't drop it, its definition should probably be changed to TSRM_ASSERT(c) assert(c) as otherwise we get the following compiler warning on release builds as can be seen from #5526 :

/home/vsts/work/1/s/TSRM/TSRM.c: In function ‘ts_free_thread’:
/home/vsts/work/1/s/TSRM/TSRM.c:482:14: warning: statement with no effect [-Wunused-value]
  TSRM_ASSERT(!in_main_thread);
             ~^~~~~~~~~~~~~~~~

@Girgias Girgias force-pushed the drop-tsrm-assert branch from 71f8e9c to 2ba8b0b Compare May 17, 2020 23:13
@Girgias
Copy link
Member Author

Girgias commented May 17, 2020

@nikic I've changed it to not rely on zend_portability.h by fixing the macro definition.

# include <assert.h>
# define TSRM_ASSERT assert
# define TSRM_ASSERT(c) assert(c)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# define TSRM_ASSERT(c) assert(c)
# define TSRM_ASSERT(c) assert(c)

@php-pulls php-pulls closed this in 3302ffb May 18, 2020
@Girgias Girgias deleted the drop-tsrm-assert branch May 18, 2020 10:55
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.

2 participants