@@ -858,19 +858,19 @@ enum diagnostic_id {
858858 W_DECLARATOR_HIDE = 7,
859859 W_TYPEOF_ARRAY_PARAMETER = 8,
860860 W_ATTRIBUTES = 9,
861- W_UNUSED_VALUE = 10,
861+ W_EXPRESSION_RESULT_NOT_USED = 10,
862862 W_STYLE = 11,
863- W_COMMENT = 12,
863+ W_MULTI_LINE_COMMENT = 12,
864864 W_LINE_SLICING = 13,
865865 W_STRING_SLICED = 14,
866866 W_DISCARDED_QUALIFIERS = 15,
867- W_DECLARATOR_STATE = 16,
867+ W_UNUSED_WARNING_16 = 16,
868868 W_UNINITIALZED = 17,
869869 W_RETURN_LOCAL_ADDR = 18,
870870 W_MUST_USE_ADDRESSOF = 19,
871871 W_ARRAY_INDIRECTION = 20,
872872
873- W_OWNERSHIP_MISSING_OWNER_QUALIFIER = 21,
873+ W_UNUSED_WARNING_21 = 21,
874874 W_OWNERSHIP_NOT_OWNER = 22,
875875 W_OWNERSHIP_USING_TEMPORARY_OWNER = 23,
876876 W_OWNERSHIP_MOVE_ASSIGNMENT_OF_NON_OWNER = 24,
@@ -884,13 +884,13 @@ enum diagnostic_id {
884884 W_FLOW_LIFETIME_ENDED = 31,
885885 W_FLOW_MOVED = 32,
886886 W_FLOW_NULL_DEREFERENCE = 33,
887- W_FLOW_MAYBE_NULL_TO_NON_OPT_ARG = 34,
887+ W_FLOW_NOT_USED_34 = 34,
888888 W_FLOW_NULLABLE_TO_NON_NULLABLE = 35,
889889 W_FLOW_DIVIZION_BY_ZERO = 36,
890890
891891
892892 W_DIVIZION_BY_ZERO = 37,
893- W_CONSTANT_VALUE = 38,
893+ W_UNUSED_WARNING_38 = 38,
894894 W_PASSING_NULL_AS_ARRAY = 39,
895895 W_INCOMPATIBLE_ENUN_TYPES = 40,
896896 W_MULTICHAR_ERROR = 41,
@@ -3012,6 +3012,10 @@ const unsigned char* _Opt escape_sequences_decode_opt(const unsigned char* p, un
30123012 case '"':
30133013 *out_value = '"';
30143014 break;
3015+
3016+ case '\n': //line slicing inside string
3017+ break;
3018+
30153019 default:
30163020 assert(false);
30173021 return NULL;
@@ -9220,7 +9224,7 @@ static struct token_list text_line(struct preprocessor_ctx* ctx, struct token_li
92209224 preprocessor_diagnostic(W_LOCATION, ctx, input_list->head, "you can use \"adjacent\" \"strings\"");
92219225 }
92229226 else if (input_list->head->type == TK_LINE_COMMENT)
9223- preprocessor_diagnostic(W_COMMENT , ctx, input_list->head, "multi-line //comment");
9227+ preprocessor_diagnostic(W_MULTI_LINE_COMMENT , ctx, input_list->head, "multi-line //comment");
92249228 else
92259229 preprocessor_diagnostic(W_LINE_SLICING, ctx, input_list->head, "unnecessary line-slicing");
92269230 }
@@ -14639,7 +14643,7 @@ int get_diagnostic_phase(enum diagnostic_id w)
1463914643 case W_FLOW_UNINITIALIZED:
1464014644 case W_FLOW_MOVED:
1464114645 case W_FLOW_NULL_DEREFERENCE:
14642- case W_FLOW_MAYBE_NULL_TO_NON_OPT_ARG :
14646+ case W_FLOW_NOT_USED_34 :
1464314647 case W_FLOW_NON_NULL:
1464414648 case W_FLOW_LIFETIME_ENDED:
1464514649 case W_FLOW_DIVIZION_BY_ZERO:
@@ -28776,7 +28780,7 @@ void defer_start_visit_declaration(struct defer_visit_ctx* ctx, struct declarati
2877628780
2877728781//#pragma once
2877828782
28779- #define CAKE_VERSION "0.12.53 "
28783+ #define CAKE_VERSION "0.12.55 "
2878028784
2878128785
2878228786
@@ -37508,28 +37512,23 @@ struct unlabeled_statement* _Owner _Opt unlabeled_statement(struct parser_ctx* c
3750837512 if (p_unlabeled_statement != NULL &&
3750937513 p_unlabeled_statement->jump_statement == NULL &&
3751037514 p_unlabeled_statement->expression_statement != NULL &&
37511- p_unlabeled_statement->expression_statement->expression_opt &&
37512- !type_is_void(&p_unlabeled_statement->expression_statement->expression_opt->type) &&
37513- p_unlabeled_statement->expression_statement->expression_opt->expression_type != ASSIGNMENT_EXPRESSION_ASSIGN &&
37514- p_unlabeled_statement->expression_statement->expression_opt->expression_type != POSTFIX_FUNCTION_CALL &&
37515- p_unlabeled_statement->expression_statement->expression_opt->expression_type != POSTFIX_INCREMENT &&
37516- p_unlabeled_statement->expression_statement->expression_opt->expression_type != POSTFIX_DECREMENT &&
37517- p_unlabeled_statement->expression_statement->expression_opt->expression_type != UNARY_EXPRESSION_INCREMENT &&
37518- p_unlabeled_statement->expression_statement->expression_opt->expression_type != UNARY_EXPRESSION_DECREMENT &&
37519- p_unlabeled_statement->expression_statement->expression_opt->expression_type != UNARY_DECLARATOR_ATTRIBUTE_EXPR &&
37520- p_unlabeled_statement->expression_statement->expression_opt->expression_type != UNARY_EXPRESSION_ASSERT)
37521- {
37522- if (ctx->current &&
37523- ctx->current->level == 0)
37515+ p_unlabeled_statement->expression_statement->expression_opt)
37516+ {
37517+ if (p_unlabeled_statement->expression_statement->expression_opt->expression_type == PRIMARY_EXPRESSION_DECLARATOR ||
37518+ p_unlabeled_statement->expression_statement->expression_opt->expression_type == PRIMARY_EXPRESSION_NUMBER)
3752437519 {
37525- #if 0
37526- //too many false..alerts.
37527- //make list of for sure ...
37528- compiler_diagnostic(W_UNUSED_VALUE,
37529- ctx,
37530- p_unlabeled_statement->expression_statement->expression_opt->first_token,
37531- "expression not used");
37532- #endif
37520+ if (ctx->current &&
37521+ ctx->current->level == 0)
37522+ {
37523+ //too many false..alerts.
37524+ //make list of for sure ...
37525+ compiler_diagnostic(W_EXPRESSION_RESULT_NOT_USED,
37526+ ctx,
37527+ p_unlabeled_statement->expression_statement->expression_opt->first_token,
37528+ NULL,
37529+ "expression result not used");
37530+
37531+ }
3753337532 }
3753437533 }
3753537534 }
@@ -41969,7 +41968,7 @@ char* _Owner _Opt CompileText(const char* pszoptions, const char* content)
4196941968
4197041969 struct report report = { 0 };
4197141970 char * s = (char* _Owner _Opt)compile_source(pszoptions, content, &report);
41972- print_report(&report);
41971+ // print_report(&report);
4197341972 return s;
4197441973}
4197541974
0 commit comments