From 4f9221ae881b1d4b5dcb5921cee1c5200a48017b Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 12 Jun 2025 14:30:50 +1000 Subject: [PATCH] MDEV-36542: remove _lint macro which is unused Attribute noreturn functions don't need a return afterwards. aria_pack was missing the noreturn attribute on its my_end function. --- client/mysql.cc | 4 +--- include/my_dbug.h | 4 ++-- include/my_global.h | 8 ++------ sql/sql_class.cc | 4 ++-- sql/sql_list.h | 2 -- sql/sql_plist.h | 2 -- storage/maria/aria_chk.c | 3 --- storage/maria/aria_pack.c | 4 +--- storage/mroonga/ha_mroonga.cpp | 2 +- storage/mroonga/mrn_mysql.h | 2 +- storage/myisam/myisamchk.c | 3 --- storage/myisam/myisampack.c | 3 --- 12 files changed, 10 insertions(+), 31 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 0781f42f64f..b9e643a12f3 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1387,9 +1387,7 @@ int main(int argc,char *argv[]) if (opt_outfile) end_tee(); mysql_end(0); -#ifndef _lint - DBUG_RETURN(0); // Keep compiler happy -#endif + DBUG_RETURN(0); } sig_handler mysql_end(int sig) diff --git a/include/my_dbug.h b/include/my_dbug.h index 02caadbff48..c72e9bb608d 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -24,7 +24,7 @@ #ifdef __cplusplus extern "C" { #endif -#if !defined(DBUG_OFF) && !defined(_lint) +#if !defined(DBUG_OFF) struct _db_stack_frame_ { const char *func; /* function name of the previous stack frame */ @@ -210,7 +210,7 @@ extern void (*my_dbug_assert_failed)(const char *assert_expr, const char* file, #define DBUG_ASSERT(A) do { } while(0) #define IF_DBUG_ASSERT(A,B) B #endif /* DBUG_ASSERT_AS_PRINTF */ -#endif /* !defined(DBUG_OFF) && !defined(_lint) */ +#endif /* !defined(DBUG_OFF) */ #ifdef EXTRA_DEBUG /** diff --git a/include/my_global.h b/include/my_global.h index 0bc9a9609ca..82b6f21f9a5 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -281,10 +281,6 @@ C_MODE_END #error "Please add -fno-exceptions to CXXFLAGS and reconfigure/recompile" #endif -#if defined(_lint) && !defined(lint) -#define lint -#endif - #ifndef stdin #include #endif @@ -502,7 +498,7 @@ C_MODE_END #endif /* We might be forced to turn debug off, if not turned off already */ -#if (defined(FORCE_DBUG_OFF) || defined(_lint)) && !defined(DBUG_OFF) +#if defined(FORCE_DBUG_OFF) && !defined(DBUG_OFF) # define DBUG_OFF # ifdef DBUG_ON # undef DBUG_ON @@ -524,7 +520,7 @@ typedef int my_socket; /* File descriptor for sockets */ #endif /* Type for functions that handles signals */ #define sig_handler RETSIGTYPE -#if defined(__GNUC__) && !defined(_lint) +#if defined(__GNUC__) typedef char pchar; /* Mixed prototypes can take char */ typedef char puchar; /* Mixed prototypes can take char */ typedef char pbool; /* Mixed prototypes can take char */ diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 1d51d793872..e821a4d4640 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -7699,7 +7699,7 @@ bool THD::binlog_for_noop_dml(bool transactional_table) } -#if defined(DBUG_TRACE) && !defined(_lint) +#if defined(DBUG_TRACE) static const char * show_query_type(THD::enum_binlog_query_type qtype) { @@ -7713,7 +7713,7 @@ show_query_type(THD::enum_binlog_query_type qtype) DBUG_ASSERT(0 <= qtype && qtype < THD::QUERY_TYPE_COUNT); } static char buf[64]; - sprintf(buf, "UNKNOWN#%d", qtype); + snprintf(buf, sizeof(buf), "UNKNOWN#%d", qtype); return buf; } #endif diff --git a/sql/sql_list.h b/sql/sql_list.h index a55f4764145..af8e20d67ae 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -836,9 +836,7 @@ public: inline void move_elements_to(I_List* new_owner) { base_ilist::move_elements_to(new_owner); } -#ifndef _lint friend class I_List_iterator; -#endif }; diff --git a/sql/sql_plist.h b/sql/sql_plist.h index 7f75208ca09..0969fef0749 100644 --- a/sql/sql_plist.h +++ b/sql/sql_plist.h @@ -158,10 +158,8 @@ public: typedef I_P_List Base; typedef I_P_List_iterator Iterator; typedef I_P_List_iterator Const_Iterator; -#ifndef _lint friend class I_P_List_iterator; friend class I_P_List_iterator; -#endif }; diff --git a/storage/maria/aria_chk.c b/storage/maria/aria_chk.c index 4bbe513b44b..c35ca3fc569 100644 --- a/storage/maria/aria_chk.c +++ b/storage/maria/aria_chk.c @@ -236,9 +236,6 @@ end: } maria_end(); my_exit(error); -#ifndef _lint - return 0; /* No compiler warning */ -#endif } /* main */ enum options_mc { diff --git a/storage/maria/aria_pack.c b/storage/maria/aria_pack.c index aad2b316c92..62926ec64ef 100644 --- a/storage/maria/aria_pack.c +++ b/storage/maria/aria_pack.c @@ -289,11 +289,9 @@ end: maria_end(); my_end(verbose ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR); exit(error ? 2 : 0); -#ifndef _lint - return 0; /* No compiler warning */ -#endif } +ATTRIBUTE_NORETURN static void my_exit(int error) { free_defaults(default_argv); diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp index 2dbc3f351cc..fb279c5458e 100644 --- a/storage/mroonga/ha_mroonga.cpp +++ b/storage/mroonga/ha_mroonga.cpp @@ -337,7 +337,7 @@ static int mrn_change_encoding(grn_ctx *ctx, const CHARSET_INFO *charset) return mrn::encoding::set(ctx, charset); } -#if defined DBUG_TRACE && !defined(_lint) +#if defined DBUG_TRACE static const char *mrn_inspect_thr_lock_type(enum thr_lock_type lock_type) { const char *inspected = ""; diff --git a/storage/mroonga/mrn_mysql.h b/storage/mroonga/mrn_mysql.h index 9573caa921d..332a5cbf480 100644 --- a/storage/mroonga/mrn_mysql.h +++ b/storage/mroonga/mrn_mysql.h @@ -59,7 +59,7 @@ #define MRN_DBUG_ENTER_FUNCTION() DBUG_ENTER(__FUNCTION__) -#if !defined(DBUG_OFF) && !defined(_lint) +#if !defined(DBUG_OFF) # define MRN_DBUG_ENTER_METHOD() \ char method_name[MRN_MESSAGE_BUFFER_SIZE]; \ method_name[0] = '\0'; \ diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 3e312269b7f..1696ec0c7db 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -124,9 +124,6 @@ int main(int argc, char **argv) my_end(check_param.testflag & T_INFO ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR); rc= (uchar) error; exit(rc); -#ifndef _lint - return 0; /* No compiler warning */ -#endif } /* main */ enum options_mc { diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index 77fdaf8e164..1d08b048d1b 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -248,9 +248,6 @@ int main(int argc, char **argv) free_defaults(default_argv); my_end(verbose ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR); exit(error ? 2 : 0); -#ifndef _lint - return 0; /* No compiler warning */ -#endif } enum options_mp {OPT_CHARSETS_DIR_MP=256};