Open mjy9088 opened 2 years ago
Describe the bug
ruined on __attribute__((noreturn))
__attribute__((noreturn))
Erroneous code
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_exit.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: Juyeong Maing <jmaing@student.42seoul.kr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/05/02 14:10:15 by Juyeong Maing #+# #+# */ /* Updated: 2022/07/31 15:36:07 by Juyeong Maing ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef FT_EXIT_H # define FT_EXIT_H # include <stdlib.h> typedef void (*t_ft_exit_cleanup_function)(); # ifdef __GNUC__ __attribute__((noreturn)) # endif int ft_exit(signed char status); void ft_set_exit_handler(void (*cleanup)()); # endif
Additional infos
Darwin c1r2s7.42seoul.kr 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 21 21:18:39 PDT 2022; root:xnu-6153.141.66~1/RELEASE_X86_64 x86_64
Python 3.8.9
norminette 3.3.51
Additional context
to suppress error Non-void function does not return a value in all control paths
Non-void function does not return a value in all control paths
static int key_press(int keycode, void *param) { (void)param; if (keycode == KEY_ESC) ft_exit(EXIT_SUCCESS); return (0); } static int fdf_exit(int unused, void *param) { (void)unused; (void)param; ft_exit(EXIT_SUCCESS); }
correct code:
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_exit.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: Juyeong Maing <jmaing@student.42seoul.kr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/05/02 14:10:15 by Juyeong Maing #+# #+# */ /* Updated: 2022/07/31 15:36:07 by Juyeong Maing ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef FT_EXIT_H # define FT_EXIT_H # include <stdlib.h> typedef void (*t_ft_exit_cleanup_function)(); # ifdef __GNUC__ __attribute__((noreturn)) # else if __STDC_VERSION__ > 201703L [[noreturn]] # endif int ft_exit(signed char status); // here void ft_set_exit_handler(void (*cleanup)()); #endif // here
duplicate #316
Describe the bug
ruined on
__attribute__((noreturn))
Erroneous code
Additional infos
Darwin c1r2s7.42seoul.kr 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 21 21:18:39 PDT 2022; root:xnu-6153.141.66~1/RELEASE_X86_64 x86_64
Python 3.8.9
norminette 3.3.51
Additional context
to suppress error
Non-void function does not return a value in all control paths
correct code: