mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	*: Use __attribute__((fallthrough)) where comments aren't supported
Although GCC now detects possibly unintentional fall through, there rules around which the comments are detected are rather strict. In cases where a comment isn't detected, upstream [recommends] using their fallthrough attribute. [recommends]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77817#c11
This commit is contained in:
		@@ -1869,7 +1869,7 @@ void tv_free(typval_T *tv)
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
      case VAR_FUNC: {
 | 
					      case VAR_FUNC: {
 | 
				
			||||||
        func_unref(tv->vval.v_string);
 | 
					        func_unref(tv->vval.v_string);
 | 
				
			||||||
        // FALLTHROUGH
 | 
					        FALLTHROUGH;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      case VAR_STRING: {
 | 
					      case VAR_STRING: {
 | 
				
			||||||
        xfree(tv->vval.v_string);
 | 
					        xfree(tv->vval.v_string);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -153,4 +153,22 @@
 | 
				
			|||||||
#define STR_(x) #x
 | 
					#define STR_(x) #x
 | 
				
			||||||
#define STR(x) STR_(x)
 | 
					#define STR(x) STR_(x)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __has_attribute
 | 
				
			||||||
 | 
					# define NVIM_HAS_ATTRIBUTE(x) 0
 | 
				
			||||||
 | 
					#elif defined(__clang__) && __clang__ == 1 \
 | 
				
			||||||
 | 
					    && (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ <= 5))
 | 
				
			||||||
 | 
					// Starting in Clang 3.6, __has_attribute was fixed to only report true for
 | 
				
			||||||
 | 
					// GNU-style attributes.  Prior to that, it reported true if _any_ backend
 | 
				
			||||||
 | 
					// supported the attribute.
 | 
				
			||||||
 | 
					# define NVIM_HAS_ATTRIBUTE(x) 0
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					# define NVIM_HAS_ATTRIBUTE __has_attribute
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if NVIM_HAS_ATTRIBUTE(fallthrough)
 | 
				
			||||||
 | 
					# define FALLTHROUGH __attribute__((fallthrough))
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					# define FALLTHROUGH
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  // NVIM_MACROS_H
 | 
					#endif  // NVIM_MACROS_H
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2047,7 +2047,7 @@ static inline ShaDaWriteResult shada_read_when_writing(
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
      case kSDReadStatusNotShaDa: {
 | 
					      case kSDReadStatusNotShaDa: {
 | 
				
			||||||
        ret = kSDWriteReadNotShada;
 | 
					        ret = kSDWriteReadNotShada;
 | 
				
			||||||
        // fallthrough
 | 
					        FALLTHROUGH;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      case kSDReadStatusReadError: {
 | 
					      case kSDReadStatusReadError: {
 | 
				
			||||||
        return ret;
 | 
					        return ret;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user