doxygen not resolving macro correctly - macros

i am using doxygen 1.8.11 together with the eclipse plugin eclox. i tried to generate the call graph for my source files. when i checked in one of the files i noticed that the call graph contained a function call which is actually disabled by a #define my expectation was not to see this function call in the call-graph.
on top of the source file :
#define MACRO_NAME FALSE
....
void Func_1(int *p)
{
....
#if (MACRO_NAME == TRUE)
Func_Call_2()
#else
Func_Call_3()
#endif
}
FALSE and TRUE are defined in one of the headers i included in the settings in "Include Paths" and i also get a hyperlink in the html report for FALSE and TRUE so doxygen is able to find the definition.
both Func_Call_2 and Func_Call_3() are drawn in the call graph, when actually i only want to see Func_Call_3().
my settings in the doxyfile are:
Enable Preprocessing YES
Macro Expansion NO
Expand Only Predefined NO
Search Includes YES
Extract All YES
Extract Static YES
i also tried with Macro Expansion YES but then i got no call-graph for this function Func_1 at all only after setting it back to NO the call graph is drawn again in the html file
the header file in which FALSE/TRUE are defined starts like this:
#ifndef HEADER_H
#define HEADER_H
.....
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
is there any other setting i can try ? so that doxygen will draw the call-graph without the disabled code ?

You can try one of the following suggestions:
Don't use TRUE and FALSE but 1 and 0 directly in the definition of MACRO_NAME and in the condition.
Don't set a value for MACRO_NAME but check whether it is defined or not.
Set Macro Expandion to YES and Expand Only Predefined to YES. Then set Predefined and/or Expand As Defined to include the relevant macro's.

Related

Also define the standard property 'grid-row' for compatibility

I'm getting the following warning on VS Code
"Also define the standard property 'grid-row' for compatibility"
For this code:
header {
-ms-grid-row: 1; /* warning here */
-ms-grid-column: 1; /* warning here */
-ms-grid-column-span: 2;
grid-area: header;
}
How can I fix it?
You can get rid of that, if you want, by setting this setting to ignore:
CSS > Lint: Vendor Prefix
When using a vendor-specific prefix, also include the standard property.
You are getting the warnings because you use one or more of these keys
-ms-grid-row
-ms-grid-column
in your elements without also using the standard non-prefixed versions at the same time:
grid-row
grid-column
So in every element where you have -ms-grid-row also include, after it in the same selector, grid-row and the same with -ms-grid-column put a grid-column after it in the same selector. And the warnings will go away. This is good practice anyways. For example:
header {
-ms-grid-row: 1; /* warning has gone away */
grid-row: 1;
-ms-grid-column: 1;
-ms-grid-column-span: 2;
grid-column: 2;
grid-area: header;
}
Or set the CSS > Lint: Vendor Prefix to ignore and you won't see the warnings - but I do not recommend doing that. You should be including the standard non-prefixed versions of those keys.

Disable check of camel case rule in eslint

I have a large JavaScript file with multiple eslint rule violations. I am trying to disable them and address them one at a time. The code below shows that I can disable them all with no trouble, but not the rule about camelcase and perhaps other individual rules. The approaches I have used should work according to the eslint documentation, but there must be a flaw in my interpretation.
The code is short and it does not eliminate the error concerning camel case.
/* eslint-disable /* eslint-disable// works but gets everything.
`/* eslint (camelcase) : 0 */
/* eslint camelcase : ["error", {ignoreDestructuring:true}] */
const Lesson_1 = {title:'The Home Row Keys.'},'lesson': 'jjj fff jjj fff'}
Just get the same camelcase error without any change. The eslint documentation says just disable the entire rule but does not specify a method other than listed above.
To disable the rule for a file add next line at the begging of a file:
for JavaScript files:
/* eslint-disable camelcase */
for TypeScript with enabled #typescript-eslint plugin:
/* eslint-disable #typescript-eslint/camelcase */
To disable the rule for all files in a project add next line to the eslint config file:
for JavaScript files:
rules: {
...
'camelcase': 'off',
}
for TypeScript with enabled #typescript-eslint plugin:
rules: {
...
'#typescript-eslint/camelcase': 'off',
}
For TypeScript, we can change the rules in the eslintrc file.
rules: {
"camelcase": "off",
"#typescript-eslint/camelcase": ["warn"]
}
We can set "off" or "warn" here. https://eslint.org/docs/user-guide/configuring#configuring-rules
This works for me
/* eslint-disable camelcase */
Update For TypeScript:
#typescript-eslint/camelcase is deprecated
use #typescript-eslint/naming-convention instead
rules: {
...
"#typescript-eslint/naming-convention": "off"
}
Or for single files
/* eslint-disable #typescript-eslint/naming-convention */
This worked for me
Use following code, and add it to each corresponding file containing variables against camelcase rules :
/* eslint-disable #typescript-eslint/class-name-casing */
/* eslint-disable #typescript-eslint/camelcase */
It works for me.
You shouldn't disable this is a bad practice but in case you wanted you can add a rule to your .eslintrc.json file in the root of your project and set camelcase to as shown in the example.
"extends": "standard",
"rules": {
"camelcase": 0
}
}
I had to use:
/* eslint-disable #typescript-eslint/naming-convention */
After moving Angular to eslint
Try the following options.
Use the next-line or same-line syntax
// eslint-disable-next-line camelcase
const Lesson_1 = {title:'The Home Row Keys.'},'lesson': 'jjj fff jjj fff'}
or (see after semi-colon)
const Lesson_1 = {title:'The Home Row Keys.'},'lesson': 'jjj fff jjj fff'}; // eslint-disable-line camelcase
Try disabling the entire file by adding the following as the first line of your file. This should ignore all camel casing errors in the entire file.
/* eslint-disable camelcase */
Note: Always check if the configuration file work against the eslint you're running. Means, there can be multiple installations of eslint - Global & local. So make sure you are running the right one. Also check the rules object in the .eslintrc configuration file.
To disable on a single file *.js or *.ts; put the following at the top of that file.
/* eslint #typescript-eslint/no-var-requires: "off" */

How can I use INPUT as INCLUDE_PATH in Doxygen configuration?

I have a C project with the subdirectories lib1 and lib2. lib2 defines things depending on defines in lib1. Therefore I set INPUT = lib1 lib2. I don't want to repeat the folders for INCLUDE_PATH (because in reality these are a lot of folders). I would like to reuse INPUT somehow.
The documentation of Doxygen states, that environment variables can be used with the syntax $(xxx). Therefore I tried INCLUDE_PATH = $(INPUT), but this doesn't work, because INPUT is not an environment variable.
lib1/lib1.h
#ifndef LIB1_H
#define LIB1_H
#define LIB1_DEPENDENCY
#endif LIB1_H
lib2/lib2.h
#include "lib1.h"
#ifdef LIB1_DEPENDENCY
//! #brief LIB1_DEPENDENCY was defined
void lib2_function(void);
#else
//! #brief LIB1_DEPENDENCY was NOT defined
void lib2_function(void);
#endif
I would expect that in the documentation the brief description of lib2_function() is "LIB1_DEPENDENCY was defined".
I am using doxygen 1.8.15.

Eslint & SAPUI5: How to remove "sap/$ not defined"?

I am using Eslint in Visual Code for my SAPUI5 project. Whenever I am defining a controller using
sap.ui.define([...
Eslint throws the error sap not defined.. The same holds for $/jQuery. Is there a way how to solve that?
Thanks
You can whitelist global variables in the eslint configuration: https://eslint.org/docs/user-guide/configuring (see "Specifying Globals").
To configure global variables inside of a configuration file, use the
globals key and indicate the global variables you want to use. Set
each global variable name equal to true to allow the variable to be
overwritten or false to disallow overwriting. For example:
{
"globals": {
"var1": true,
"var2": false
}
}
Usually you have some kind of .eslintrc.js file where you can include this.
Here is an example: https://github.com/pulseshift/openui5-gulp-starter-kit/blob/master/.eslintrc.js

Npapi Plugin not detected in demobrowser of QtWebkit

I am a newbie to StackOverflow and QtWebkit as well.
I have written a very basic Npapi plugin which has functions like NP_GetMimeTypeDescription and Np_Initialise etc for Mimetype application/basic-plugin and Mimetype description application/basic-plugin:bsc:Plug-ins SDK sample.
But I am facing a problem while loading it on the demobrowser of QtWebKit and also on Mozilla Firefox. I have placed the generated .so file in the paths where ever browser finds plugins like /usr/lib/mozilla/plugins/ and Qt Lib path.
I have a test.html file which contains the Mimetype application/basic-plugin. I am trying to launch this plugin in both the Mozilla browser and QtWebKit Demo Browser But in both the cases its not launching the plugin.
I am not able to find out why.
Any suggestions are Welcome...
Thanks for help and suggestions.
I was able to find out the problem why my plugin was not getting invoked,
even if I placed the .so file in the correct folders
/usr/lib/mozilla/plugins/ and Qt Lib path.
There were 2 reasons...
Had to enable the Define XP_UNIX (-DXP_UNIX) during compilation as a compiler directive.
This will consider different prototypes of the functions and also implementation
extern "C"
NPError OSCALL NP_Initialize(NPNetscapeFuncs *browserFuncs
#ifdef XP_UNIX
, NPPluginFuncs *pluginFuncs
#endif
)
{
// keep a pointer to the browser functions
g_browser = browserFuncs;
// any memory that is to be shared by all instances of
the browser plugin should be initialized here.
;
#ifdef XP_UNIX
// under Linux, as the browser won't call NP_GetEntryPoints()
explicitly, do it now to fill in <pluginFuncs>
return NP_GetEntryPoints(pluginFuncs);
#else
return NPERR_NO_ERROR;
#endif
}
and
extern "C"
#ifdef XP_UNIX
NPError NP_GetValue(void* instance, NPPVariable variable, void *value)
#else
NPError NP_GetValue(NPP instance, NPPVariable variable, void *value)
#endif
2.. There were 2 functions NP_GetValue and NPP_GetValue.
extern "C"
NPError NP_GetValue(void* instance, NPPVariable variable, void *value);
and
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *ret_value);
NPP_GetValue is a plugin function whose registration should be made in
NP_GetEntryPoints
extern "C"
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* NPPluginFuncsptr)
{
......
NPPluginFuncsptr->newp = NPP_New;
NPPluginFuncsptr->getvalue = NPP_GetValue;
NPPluginFuncsptr->setvalue = NPP_SetValue;
return NPERR_NO_ERROR;
}
In my code only NP_GetValue was implemented and NPP_GetValue was not implemented.
So NPP_GetValue was undefined in .so and due to it the .so was not loading.
On implementing the function NPP_GetValue this function was defined and exported in the .so file and was able to load it successfully.
The sequence of calling of the functions from the browser to plugin is as follows...
NP_Initialize - > Browser calls the initialization function first.
(In case of Linux the set of plugin function should be exported by calling
NP_GetEntryPoints explicity As browser will not call GetEntryPoints)
NP_GetEntryPoints -> Called explicitly from NP_Initialize for Linux to
expose/export plugin functions.
NP_GetValue variable : 1 -> Called from Browser to get the Plugin Name
(NPPVpluginNameString)
NP_GetValue variable : 2 -> Called from Browser to get the
Plugin Description (NPPVpluginDescriptionString)
NP_GetMimeDescription -> Called from browser to get MimeType Description
(This function should return Mime Type description
e.g. :
return("application/basic-plugin:bsc:Plug-ins SDK sample");)
NPP_New -> Called from browser to create plugin instance.
NPP_GetValue PLUGIN:main.cpp,NPP_GetValue,446ENTRY - > Called from browser to get plugin specific data...
......
Please note that the next function in the above sequence will be called
IF and ONLY IF the previous function call returns a success.:-)