gnucap-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnucap-models


From: karl
Subject: gnucap-models
Date: Sat, 2 Apr 2022 20:44:24 +0200 (CEST)

https://git.savannah.gnu.org/cgit/gnucap/gnucap-models.git
gives a few compiler warnings.

A patch to fix thoose warnings is available at
 http://aspodata.se/electronic/gnucap-models.patch
The READMEs might need to changed if you apply this patch

///
b4temp.c:1408:60: warning: format  %g  expects a matching  double  argument 
[-Wformat=]
and similar:

$ sed -ne '1405,1409p' plugins/models-bsim/BSIM450/b4temp.c 
                T3 =  1.0 + pParam->BSIM4ku0we * sceff;
                if (T3 <= 0.0) 
                {       T3 = 0.0;
                        fprintf(stderr, "Warning: ku0we = %g is negatively too 
high. Negative mobility! \n");
                }
$ grep ' ku0we = %g is negatively too high' plugins/models-bsim/*/b4temp.c
plugins/models-bsim/BSIM450/b4temp.c:                        fprintf(stderr, 
"Warning: ku0we = %g is negatively too high. Negative mobility! \n");
plugins/models-bsim/BSIM460/b4temp.c:                        fprintf(stderr, 
"Warning: ku0we = %g is negatively too high. Negative mobility! \n");
plugins/models-bsim/BSIM461/b4temp.c:                        fprintf(stderr, 
"Warning: ku0we = %g is negatively too high. Negative mobility! \n");
plugins/models-bsim/BSIM462/b4temp.c:                        fprintf(stderr, 
"Warning: ku0we = %g is negatively too high. Negative mobility! \n");
plugins/models-bsim/BSIM463/b4temp.c:                        fprintf(stderr, 
"Warning: ku0we = %g is negatively too high. Negative mobility! \n");
plugins/models-bsim/BSIM464/b4temp.c:                        fprintf(stderr, 
"Warning: ku0we = %g is negatively too high. Negative mobility! \n");
plugins/models-bsim/BSIM465/b4temp.c:                        fprintf(stderr, 
"Warning: ku0we = %g is negatively too high. Negative mobility! \n");

Why not just drop the "= %g" part.

///

b3soild.c:354:62: warning: format  %d  expects a matching  int  argument 
[-Wformat=]
and similar:

$ grep 'op. point converge with %d iterations' plugins/models-bsim/*/b3soild.c 
plugins/models-bsim/BSIMDD2p1/b3soild.c:                 fprintf(stderr,"DC op. 
point converge with %d iterations\n");
plugins/models-bsim/BSIMFD2p1/b3soild.c:                 fprintf(stderr,"DC op. 
point converge with %d iterations\n");

This is missing: here->B3SOIiterations);
as can be seen in the next else if.

///

./ltradefs.h:96:29: warning: "/*" within comment [-Wcomment]

$ sed -ne '96p' plugins/models-spice3f5/ltra/ltradefs.h 
        /*double LTRAh2FirstOthVal;/* needed for LTE calc; but their values */

Just add a */ befor the /*.

///

$ sed -ne '266,273p'  plugins/models-spice3f5/ltra/ltraset.c 
            if (here->LTRAbrEq1) {
                CKTdltNNum(ckt, (GENERIC *) here->LTRAbrEq1);
                here->LTRAbrEq1 = 0;
            }
            if (here->LTRAbrEq2) {
                CKTdltNNum(ckt, (GENERIC *) here->LTRAbrEq2);
                here->LTRAbrEq2 = 0;
            }
a few lines above we have:
    LTRAinstance *here;
LTRAinstance is defined in ltradefs.h
$ sed -ne '20,70p' plugins/models-spice3f5/ltra/ltradefs.h | egrep '{|}|LTRAbr'
typedef struct sLTRAinstance {
    int LTRAbrEq1;       /* number of branch equation for end 1 of t. line */
    int LTRAbrEq2;       /* number of branch equation for end 2 of t. line */
} LTRAinstance ;

I cannot find out where CKTdltNNum is defined from the makefiles, but 
elsewhere it is defined as
$ find plugins/ -type f -name \*.h | xargs grep CKTdltNNum
plugins/models-ngspice17/Include/cktdefs.h:extern int CKTdltNNum(void *, int );

Here GENERIC is either a void or a char according to:
 plugins/models-spice3f5/Include/ifsim.h

Why not just remove the cast.

///

There are a lot of warnings like:
warning: format ?%s? expects argument of type ?char *?, but argument 3 has type 
?IFuid {aka void *}? [-Wformat=]

%s of a void * doesn't make sense.
It seems that in all theese cases the argument is defined as an IFuid.

 IFuid is defined (e.g. in):
plugins/models-bsim/Include/ifsim.h:typedef GENERIC *IFuid;
but one should consider having it as a char *, or makeing a
IFuid to char* routine.

 ===
One is the last line of:
$ sed -ne '167,171p' plugins/models-jspice3-2.5/src/srcparse.c 
                parm = INPgetValue(ckt,&line,IF_INSTANCE,tab);
                GCA(INPpName,("control",parm,ckt,type,fast))

                /* set alias for "x" in function */
                sprintf(buf,"i(%s)",parm->uValue);

That code won't work since (../gnucap is the git dir):

$ find ../gnucap/ -type f  | xargs grep INPgetValue 2>/dev/null 
../gnucap/include/spice-wrapper.cc:  IFvalue 
*INPgetValue(GENERIC*,char**,int,INPtables*) {incomplete(); return NULL;}
$ find ../gnucap/ -type f  | xargs grep INPpName 2>/dev/null 
../gnucap/include/spice-wrapper.cc:  int 
INPpName(char*,IFvalue*,GENERIC*,int,GENERIC*) {incomplete(); return 0;}

so parm = NULL and parm->uValue is undefined.
 ===
Another is (the JJcontrol part):
$ sed -ne '156,158p' plugins/models-jspice3-2.5/jj/jjsetup.c 
                    (void) sprintf(emsg,
"Warning: %s control current modulated by non-existent\n\
or non-branch device %s, ignored.",here->JJname,here->JJcontrol);

JJcontrol and uValue seems related.
 ===
In all other cases (273 warnings) the %s format have an argument with
name or Name in its name.

E.g.:
$ sed -ne '153,155p' plugins/models-bsim/BSIM3v324/b3noi.c 
                                  {    (void) sprintf(name, "onoise.%s%s",
                                                      here->BSIM3name,
                                                      BSIM3nNames[i]);
 ===
The quick fix is to typedef IFuid to a char*.

Regards,
/Karl Hammar




reply via email to

[Prev in Thread] Current Thread [Next in Thread]