From 0390908588fa7d904bba8b0920181f921f79906d Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Mon, 23 Dec 2013 15:23:11 +0000 Subject: [PATCH] Consolidating some mode attribute diagnostics. No functional changes intended. llvm-svn: 197911 --- clang/include/clang/Basic/DiagnosticSemaKinds.td | 3 +-- clang/lib/Sema/SemaDeclAttr.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index b92544fc7cd0..838ce635423e 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -2354,8 +2354,7 @@ def warn_attribute_protected_visibility : InGroup>; def err_mismatched_visibility: Error<"visibility does not match previous declaration">; def note_previous_attribute : Note<"previous attribute is here">; -def err_unknown_machine_mode : Error<"unknown machine mode %0">; -def err_unsupported_machine_mode : Error<"unsupported machine mode %0">; +def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">; def err_mode_not_primitive : Error< "mode attribute only supported for integer and floating-point types">; def err_mode_wrong_type : Error< diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index a0421aa0d088..56df48230cb7 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2989,7 +2989,7 @@ static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) { // FIXME: Make sure floating-point mappings are accurate // FIXME: Support XF and TF types if (!DestWidth) { - S.Diag(Attr.getLoc(), diag::err_unknown_machine_mode) << Name; + S.Diag(Attr.getLoc(), diag::err_machine_mode) << 0 /*Unknown*/ << Name; return; } @@ -3002,7 +3002,7 @@ static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) { NewTy = S.Context.getRealTypeForBitwidth(DestWidth); if (NewTy.isNull()) { - S.Diag(Attr.getLoc(), diag::err_unsupported_machine_mode) << Name; + S.Diag(Attr.getLoc(), diag::err_machine_mode) << 1 /*Unsupported*/ << Name; return; }