From acf14f15c8ab5c38232fc6b4ab38f6840203bc62 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Wed, 10 Jul 2024 22:38:30 +0900 Subject: [PATCH] Add option to suppress experimental notices This commit introduces a new RAYAOP_QUIET macro which, when set, suppresses experimental notices for the Ray.Aop PHP extension. The option to enable or disable it is included in the config.m4 file. --- config.m4 | 7 +++++++ rayaop.c | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/config.m4 b/config.m4 index 03bfadf..4244685 100644 --- a/config.m4 +++ b/config.m4 @@ -34,4 +34,11 @@ if test "$PHP_RAYAOP" != "no"; then dnl Add instruction to install header files dnl link https://www.phpinternalsbook.com/build_system/build_system.html#php-install-headers PHP_INSTALL_HEADERS([ext/rayaop], [php_rayaop.h]) + + PHP_ARG_ENABLE(rayaop-quiet, whether to suppress experimental notices, + [ --enable-rayaop-quiet Suppress experimental notices], no, yes) + + if test "$PHP_RAYAOP_QUIET" != "no"; then + AC_DEFINE(RAYAOP_QUIET, 1, [Whether to suppress experimental notices]) + fi fi diff --git a/rayaop.c b/rayaop.c index 44403f8..2192d3c 100644 --- a/rayaop.c +++ b/rayaop.c @@ -4,6 +4,10 @@ #define PHP_RAYAOP_VERSION "0.1.0" +#ifndef RAYAOP_QUIET +#define RAYAOP_QUIET 0 +#endif + #include "php_rayaop.h" /* Include header file for RayAOP extension */ /* Declaration of module global variables */ @@ -332,6 +336,10 @@ PHP_MINIT_FUNCTION(rayaop) { php_rayaop_init_globals(&rayaop_globals); /* Initialize global variables in non-thread-safe mode */ #endif +#if PHP_RAYAOP_EXPERIMENTAL && !RAYAOP_QUIET + php_error_docref(NULL, E_NOTICE, "The Ray.Aop extension is experimental. Its functions may change or be removed in future releases."); +#endif + zend_class_entry ce; INIT_CLASS_ENTRY(ce, "Ray\\Aop\\MethodInterceptorInterface", ray_aop_method_interceptor_interface_methods); /* Initialize class entry */