mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu-mainline.git
				synced 2025-03-21 01:53:15 +00:00 
			
		
		
		
	Merge pull request #1018 from bbarenblat/master
Handle invalid `Log::Level::Count`
This commit is contained in:
		
						commit
						b6c241d667
					
				@ -6,6 +6,7 @@
 | 
				
			|||||||
#include <array>
 | 
					#include <array>
 | 
				
			||||||
#include <cstdio>
 | 
					#include <cstdio>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "common/assert.h"
 | 
				
			||||||
#include "common/common_funcs.h" // snprintf compatibility define
 | 
					#include "common/common_funcs.h" // snprintf compatibility define
 | 
				
			||||||
#include "common/logging/backend.h"
 | 
					#include "common/logging/backend.h"
 | 
				
			||||||
#include "common/logging/filter.h"
 | 
					#include "common/logging/filter.h"
 | 
				
			||||||
@ -78,8 +79,9 @@ const char* GetLevelName(Level log_level) {
 | 
				
			|||||||
        LVL(Warning);
 | 
					        LVL(Warning);
 | 
				
			||||||
        LVL(Error);
 | 
					        LVL(Error);
 | 
				
			||||||
        LVL(Critical);
 | 
					        LVL(Critical);
 | 
				
			||||||
 | 
					        case Level::Count:
 | 
				
			||||||
 | 
					            UNREACHABLE();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return "Unknown";
 | 
					 | 
				
			||||||
#undef LVL
 | 
					#undef LVL
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -14,6 +14,7 @@
 | 
				
			|||||||
#include "common/logging/log.h"
 | 
					#include "common/logging/log.h"
 | 
				
			||||||
#include "common/logging/text_formatter.h"
 | 
					#include "common/logging/text_formatter.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "common/assert.h"
 | 
				
			||||||
#include "common/common_funcs.h"
 | 
					#include "common/common_funcs.h"
 | 
				
			||||||
#include "common/string_util.h"
 | 
					#include "common/string_util.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -82,6 +83,8 @@ void PrintColoredMessage(const Entry& entry) {
 | 
				
			|||||||
        color = FOREGROUND_RED | FOREGROUND_INTENSITY; break;
 | 
					        color = FOREGROUND_RED | FOREGROUND_INTENSITY; break;
 | 
				
			||||||
    case Level::Critical: // Bright magenta
 | 
					    case Level::Critical: // Bright magenta
 | 
				
			||||||
        color = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
 | 
					        color = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY; break;
 | 
				
			||||||
 | 
					    case Level::Count:
 | 
				
			||||||
 | 
					        UNREACHABLE();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SetConsoleTextAttribute(console_handle, color);
 | 
					    SetConsoleTextAttribute(console_handle, color);
 | 
				
			||||||
@ -101,6 +104,8 @@ void PrintColoredMessage(const Entry& entry) {
 | 
				
			|||||||
        color = ESC "[1;31m"; break;
 | 
					        color = ESC "[1;31m"; break;
 | 
				
			||||||
    case Level::Critical: // Bright magenta
 | 
					    case Level::Critical: // Bright magenta
 | 
				
			||||||
        color = ESC "[1;35m"; break;
 | 
					        color = ESC "[1;35m"; break;
 | 
				
			||||||
 | 
					    case Level::Count:
 | 
				
			||||||
 | 
					        UNREACHABLE();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fputs(color, stderr);
 | 
					    fputs(color, stderr);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user