{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Ignore litgen warnings\n", "\n", "When processing code, litgen may emit some warnings when it encounters code that it cannot process. If possible, you can change the options in order to handle those warnings. \n", "\n", "\n", "## Example code with potential warnings\n", "\n", "However, there may be some warnings that you want to ignore. See the example below, where we use the code from a file name `10_05_10_sample_code.h`.\n", "\n", "Let's load it and display its content:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", " \n", " \n", "
// This will trigger a warning:\n",
"// Ignoring template function. You might need to set LitgenOptions.fn_template_options\n",
"// While parsing a "function_decl", corresponding to this C++ code:\n",
"// Position:4:1\n",
"// template<typename T> void MyOperation(T value);\n",
"template<typename T> void MyOperation(T value);\n",
"\n",
"\n",
"struct Foo {};\n",
"\n",
"\n",
"// This will generate a warning:\n",
"// operators are supported only when implemented as a member functions\n",
"// And this operator will not be exported\n",
"bool operator==(const Foo& v1, const Foo& v2);\n",
"\n",
"\n",
"// litgen does not support C-style function parameters\n",
"// This function will trigger a warning: "Can't use a function_decl as a param"\n",
"int CallOperation(int (*functionPtr)(int, int), int a, int b) {\n",
" return (*functionPtr)(a, b);\n",
"}\n",
"
#################### <generated_from:10_05_10_sample_code.h> ####################\n",
"\n",
"\n",
"\n",
"class Foo:\n",
" def __init__(self) -> None:\n",
" """Auto-generated default constructor"""\n",
" pass\n",
"\n",
"\n",
"\n",
"\n",
"#################### </generated_from:10_05_10_sample_code.h> ####################\n",
"