Skip to content

Sync #if/ifdef/defined (-Wundef) #14623

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

Merged
merged 3 commits into from
Jun 24, 2024
Merged

Sync #if/ifdef/defined (-Wundef) #14623

merged 3 commits into from
Jun 24, 2024

Conversation

petk
Copy link
Member

@petk petk commented Jun 21, 2024

These are either define (to value 1) or undefined:

  • __GNUC__
  • DBA_CDB_BUILTIN
  • DBA_GDBM
  • HAVE_FORK
  • HAVE_PUTENV
  • HAVE_SETENV
  • HAVE_SYS_SELECT_H
  • HAVE_SYS_SOCKET_H
  • HAVE_SYS_WAIT_H
  • HAVE_UNSETENV
  • RFC3678_API
  • ZEND_ENABLE_ZVAL_LONG64
  • ZTS

Follow-up of GH-5526

These are either define (to value 1) or undefined:
- __GNUC__
- DBA_CDB_BUILTIN
- DBA_GDBM
- HAVE_FORK
- HAVE_PUTENV
- HAVE_SETENV
- HAVE_SYS_SELECT_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_WAIT_H
- HAVE_UNSETENV
- RFC3678_API
- ZEND_ENABLE_ZVAL_LONG64
- ZTS

Follow-up of phpGH-5526
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Not sure about the sockets/multicast.c change and the ZendAccelerator one, but the rest looks good.

Comment on lines -421 to 423
#if __GNUC__
#ifdef __GNUC__
__attribute__((format(printf, 2, 3)))
#endif
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this just use ZEND_ATTRIBUTE_FORMAT ? or is this file not including anything from Zend/PHP currently?

Copy link
Member Author

Choose a reason for hiding this comment

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

Then I think it can be added in the includes, yes. Ok, good one. Thanks for finding it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added the zend_portability.h in it and used ZEND_ATTRIBUTE_FORMAT.

Copy link
Member

@devnexen devnexen left a comment

Choose a reason for hiding this comment

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

sockets part looks good

Comment on lines 420 to 421
void LSAPI_Log(int flag, const char * fmt, ...)
#if __GNUC__
__attribute__((format(printf, 2, 3)))
#endif
;

void LSAPI_Log(int flag, const char * fmt, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be isolated from Zend, I think I prefer what you had before so we don't have unnecessary dependency on Zend if not needed.

Copy link
Member Author

@petk petk Jun 22, 2024

Choose a reason for hiding this comment

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

Sure, added back as it was with only ifdef changed.

I was already thinking about these __attribute__ items and how to improve it. It might fit a bit better together once we add a minimum compiler requirement in the future to rely on __has_attribute feature that comes with GCC 5 and later and clang 2.9 and later (I think). With some other adjustments for some almost obsolete platforms. Because now PHP doesn't have this resolved optimally yet.

The lsapilib.h shouldn't at this point depend on Zend.
@petk
Copy link
Member Author

petk commented Jun 24, 2024

Merge coming up then since these are all not problematic changes in terms of behavior. I've missed the comment above about the RFC3678_API in the multicast.c. From what I see, this one is defined in the PHP itself and not in the system header(s). It is also already used with #ifdef in the PHP-src code, so I think it's all good.

@petk petk merged commit cf3b9fc into php:master Jun 24, 2024
9 of 11 checks passed
@petk petk deleted the patch-wundef branch June 24, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants