From d90cb7caf3fef1cf6e73b059e42548974749e240 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sun, 17 May 2020 12:11:10 +0200 Subject: [PATCH] Update doc --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7bd2e469..d8a1f352 100644 --- a/README.md +++ b/README.md @@ -675,9 +675,19 @@ is needed to avoid losing memory. See issue #15. ERRORS & COMPILERS ------------------ -When defining the oplist of a type using M\*LIB, sometimes (often) the list of errors/warnings generated -by the compiler can be (very) huge (specially with latest compilers), -even if the error itself is minor. This is more or less the same as the use of template in C++. +M\*LIB implements internally some controls to reduce the list of errors/warnings generated by a compiler +when it detects some violation in the use of oplist by use of static assertion. +It can also transform some type warnings into proper errors. +In C99 mode, it will produce illegal code with the name of the error as attribute. +In C11 mode, it will use static assert and produce a detailled error message. + +The list of errors it can generate: + +* M\_LIB\_NOT\_AN\_OPLIST: something has been given (directly or indirectly) and it doesn't reduce as a proper oplist. You need to give an oplist for this definition. +* M\_LIB\_ERROR(ARGUMENT\_OF\_\*\_OPLIST\_IS\_NOT\_AN\_OPLIST, name, oplist): sub error of the previous error one, identying the root cause. The error is in the oplist construction of the given macro. You need to give an oplist for this oplist construction. +* M\_LIB\_MISSING\_METHOD: a required operator doesn't define any method in the given oplist. You need to complete the oplist with the missing method. +* M\_LIB\_TYPE\_MISTMACH: the given oplist and the type do not match each other. You need to give the right oplist for this type. +* M\_LIB\_NOT\_A\_DEFAULT\_TYPE: The oplist M\_DEFAULT\_OPLIST (directly or indireclty) has been used with the given type, but the given type is not a default type. You need to give the right oplist for this type. You should focus mainly on the first reported error/warning even if the link between what the compiler report and what the error is @@ -695,7 +705,7 @@ Examples of typical errors: A good way to avoid theses errors is to register the oplist globally as soon as you define the container. -Another way to debug is to generate the preprocessed file +In case of difficulties, debugging can be done by generating the preprocessed file (by usually calling the compiler with the '-E' option instead of '-c') and check what's wrong in the preprocessed file: