Print this page
make: fix GCC warnings


 191 static  void            report_recursion(Name);
 192 static  void            set_sgs_support(void);
 193 static  void            setup_for_projectdir(void);
 194 static  void            setup_makeflags_argv(void);
 195 static  void            report_dir_enter_leave(Boolean entering);
 196 
 197 extern void expand_value(Name, register String , Boolean);
 198 
 199 #ifdef DISTRIBUTED
 200         extern  int             dmake_ofd;
 201         extern  FILE*           dmake_ofp;
 202         extern  int             rxmPid;
 203         extern  XDR             xdrs_out;
 204 #endif
 205 #ifdef TEAMWARE_MAKE_CMN
 206         extern  char            verstring[];
 207 #endif
 208 
 209 jmp_buf jmpbuffer;
 210 #if !defined(linux)
 211 nl_catd catd;
 212 #endif
 213 
 214 /*
 215  *      main(argc, argv)
 216  *
 217  *      Parameters:
 218  *              argc                    You know what this is
 219  *              argv                    You know what this is
 220  *
 221  *      Static variables used:
 222  *              list_all_targets        make -T seen
 223  *              trace_status            make -p seen
 224  *
 225  *      Global variables used:
 226  *              debug_level             Should we trace make actions?
 227  *              keep_state              Set if .KEEP_STATE seen
 228  *              makeflags               The Name "MAKEFLAGS", used to get macro
 229  *              remote_command_name     Name of remote invocation cmd ("on")
 230  *              running_list            List of parallel running processes
 231  *              stdout_stderr_same      true if stdout and stderr are the same


1430                 /*
1431                  * If we're done processing all of the options of
1432                  * ONE argument string...
1433                  */
1434                 if (current_optind < optind) {
1435                         i = current_optind;
1436                         k = 0;
1437                         /* If there's an argument for an option... */
1438                         if ((optind - current_optind) > 1) {
1439                                 k = i + 1;
1440                         }
1441                         switch (makefile_next) {
1442                         case 0:
1443                                 argv[i] = NULL;
1444                                 /* This shouldn't happen */
1445                                 if (k) {
1446                                         argv[k] = NULL;
1447                                 }
1448                                 break;
1449                         case 1: /* -f seen */
1450                                 argv[i] = NOCATGETS("-f");
1451                                 break;
1452                         case 2: /* -c seen */
1453                                 argv[i] = NOCATGETS("-c");
1454 #ifndef TEAMWARE_MAKE_CMN
1455                                 warning(catgets(catd, 1, 281, "Ignoring DistributedMake -c option"));
1456 #endif
1457                                 break;
1458                         case 4: /* -g seen */
1459                                 argv[i] = NOCATGETS("-g");
1460 #ifndef TEAMWARE_MAKE_CMN
1461                                 warning(catgets(catd, 1, 282, "Ignoring DistributedMake -g option"));
1462 #endif
1463                                 break;
1464                         case 8: /* -j seen */
1465                                 argv[i] = NOCATGETS("-j");
1466 #ifndef TEAMWARE_MAKE_CMN
1467                                 warning(catgets(catd, 1, 283, "Ignoring DistributedMake -j option"));
1468 #endif
1469                                 break;
1470                         case 16: /* -M seen */
1471                                 argv[i] = NOCATGETS("-M");
1472 #ifndef TEAMWARE_MAKE_CMN
1473                                 warning(catgets(catd, 1, 284, "Ignoring ParallelMake -M option"));
1474 #endif
1475                                 break;
1476                         case 32: /* -m seen */
1477                                 argv[i] = NOCATGETS("-m");
1478 #ifndef TEAMWARE_MAKE_CMN
1479                                 warning(catgets(catd, 1, 285, "Ignoring DistributedMake -m option"));
1480 #endif
1481                                 break;
1482 #ifndef PARALLEL
1483                         case 128: /* -O seen */
1484                                 argv[i] = NOCATGETS("-O");
1485                                 break;
1486 #endif
1487                         case 256: /* -K seen */
1488                                 argv[i] = NOCATGETS("-K");
1489                                 break;
1490                         case 512:       /* -o seen */
1491                                 argv[i] = NOCATGETS("-o");
1492 #ifndef TEAMWARE_MAKE_CMN
1493                                 warning(catgets(catd, 1, 311, "Ignoring DistributedMake -o option"));
1494 #endif
1495                                 break;
1496                         case 1024: /* -x seen */
1497                                 argv[i] = NOCATGETS("-x");
1498 #ifndef TEAMWARE_MAKE_CMN
1499                                 warning(catgets(catd, 1, 353, "Ignoring DistributedMake -x option"));
1500 #endif
1501                                 break;
1502                         default: /* > 1 of -c, f, g, j, K, M, m, O, o, x seen */
1503                                 fatal(catgets(catd, 1, 286, "Illegal command line. More than one option requiring\nan argument given in the same argument group"));
1504                         }
1505 
1506                         makefile_next = 0;
1507                         current_optind = optind;
1508                 }
1509         }
1510 }
1511 
1512 static void
1513 quote_str(char *str, char *qstr)
1514 {
1515         char            *to;
1516         char            *from;
1517 


1633         /* Find the number of arguments in MAKEFLAGS */
1634         while (cp && *cp) {
1635                 /* Skip white spaces */
1636                 while (cp && *cp && isspace(*cp)) {
1637                         cp++;
1638                 }
1639                 if (cp && *cp) {
1640                         /* Increment arg count */
1641                         mf_argc++;
1642                         /* Go to next white space */
1643                         while (cp && *cp && !isspace(*cp)) {
1644                                 if(*cp == (int) backslash_char) {
1645                                         cp++;
1646                                 }
1647                                 cp++;
1648                         }
1649                 }
1650         }
1651         /* Allocate memory for the new MAKEFLAGS argv */
1652         mf_argv = (char **) malloc((mf_argc + 1) * sizeof(char *));
1653         mf_argv[0] = NOCATGETS("MAKEFLAGS");
1654         /*
1655          * Convert the MAKEFLAGS string value into a vector of char *,
1656          * similar to argv.
1657          */
1658         cp = cp_orig;
1659         for (i = 1; i < mf_argc; i++) {
1660                 /* Skip white spaces */
1661                 while (cp && *cp && isspace(*cp)) {
1662                         cp++;
1663                 }
1664                 if (cp && *cp) {
1665                         cp_orig = cp;
1666                         /* Go to next white space */
1667                         while (cp && *cp && !isspace(*cp)) {
1668                                 if(*cp == (int) backslash_char) {
1669                                         cp++;
1670                                 }
1671                                 cp++;
1672                         }
1673                         tmp_char = *cp;


3003                         /* Illegal MAKEFLAGS argument */
3004                         continue;
3005                 }
3006                 if(append) {
3007                         setvar_append(name, value);
3008                         append = false;
3009                 } else {
3010                         macro = maybe_append_prop(name, macro_prop);
3011                         macro->body.macro.exported = true;
3012                         SETVAR(name, value, false)->body.macro.read_only = true;
3013                 }
3014         }
3015 }
3016 
3017 /*
3018  * Append the DMake option and value to the MAKEFLAGS string.
3019  */
3020 static void
3021 append_makeflags_string(Name name, register String makeflags_string)
3022 {
3023         char            *option;
3024 
3025         if (strcmp(name->string_mb, NOCATGETS("DMAKE_GROUP")) == 0) {
3026                 option = NOCATGETS(" -g ");
3027         } else if (strcmp(name->string_mb, NOCATGETS("DMAKE_MAX_JOBS")) == 0) {
3028                 option = NOCATGETS(" -j ");
3029         } else if (strcmp(name->string_mb, NOCATGETS("DMAKE_MODE")) == 0) {
3030                 option = NOCATGETS(" -m ");
3031         } else if (strcmp(name->string_mb, NOCATGETS("DMAKE_ODIR")) == 0) {
3032                 option = NOCATGETS(" -o ");
3033         } else if (strcmp(name->string_mb, NOCATGETS("DMAKE_RCFILE")) == 0) {
3034                 option = NOCATGETS(" -c ");
3035         } else if (strcmp(name->string_mb, NOCATGETS("PMAKE_MACHINESFILE")) == 0) {
3036                 option = NOCATGETS(" -M ");
3037         } else if (strcmp(name->string_mb, NOCATGETS("DMAKE_OUTPUT_MODE")) == 0) {
3038                 option = NOCATGETS(" -x DMAKE_OUTPUT_MODE=");
3039         } else if (strcmp(name->string_mb, NOCATGETS("SUN_MAKE_COMPAT_MODE")) == 0) {
3040                 option = NOCATGETS(" -x SUN_MAKE_COMPAT_MODE=");
3041         } else {
3042                 fatal(catgets(catd, 1, 289, "Internal error: name not recognized in append_makeflags_string()"));
3043         }




 191 static  void            report_recursion(Name);
 192 static  void            set_sgs_support(void);
 193 static  void            setup_for_projectdir(void);
 194 static  void            setup_makeflags_argv(void);
 195 static  void            report_dir_enter_leave(Boolean entering);
 196 
 197 extern void expand_value(Name, register String , Boolean);
 198 
 199 #ifdef DISTRIBUTED
 200         extern  int             dmake_ofd;
 201         extern  FILE*           dmake_ofp;
 202         extern  int             rxmPid;
 203         extern  XDR             xdrs_out;
 204 #endif
 205 #ifdef TEAMWARE_MAKE_CMN
 206         extern  char            verstring[];
 207 #endif
 208 
 209 jmp_buf jmpbuffer;
 210 #if !defined(linux)
 211 extern nl_catd catd;
 212 #endif
 213 
 214 /*
 215  *      main(argc, argv)
 216  *
 217  *      Parameters:
 218  *              argc                    You know what this is
 219  *              argv                    You know what this is
 220  *
 221  *      Static variables used:
 222  *              list_all_targets        make -T seen
 223  *              trace_status            make -p seen
 224  *
 225  *      Global variables used:
 226  *              debug_level             Should we trace make actions?
 227  *              keep_state              Set if .KEEP_STATE seen
 228  *              makeflags               The Name "MAKEFLAGS", used to get macro
 229  *              remote_command_name     Name of remote invocation cmd ("on")
 230  *              running_list            List of parallel running processes
 231  *              stdout_stderr_same      true if stdout and stderr are the same


1430                 /*
1431                  * If we're done processing all of the options of
1432                  * ONE argument string...
1433                  */
1434                 if (current_optind < optind) {
1435                         i = current_optind;
1436                         k = 0;
1437                         /* If there's an argument for an option... */
1438                         if ((optind - current_optind) > 1) {
1439                                 k = i + 1;
1440                         }
1441                         switch (makefile_next) {
1442                         case 0:
1443                                 argv[i] = NULL;
1444                                 /* This shouldn't happen */
1445                                 if (k) {
1446                                         argv[k] = NULL;
1447                                 }
1448                                 break;
1449                         case 1: /* -f seen */
1450                                 argv[i] = (char *)NOCATGETS("-f");
1451                                 break;
1452                         case 2: /* -c seen */
1453                                 argv[i] = (char *)NOCATGETS("-c");
1454 #ifndef TEAMWARE_MAKE_CMN
1455                                 warning(catgets(catd, 1, 281, "Ignoring DistributedMake -c option"));
1456 #endif
1457                                 break;
1458                         case 4: /* -g seen */
1459                                 argv[i] = (char *)NOCATGETS("-g");
1460 #ifndef TEAMWARE_MAKE_CMN
1461                                 warning(catgets(catd, 1, 282, "Ignoring DistributedMake -g option"));
1462 #endif
1463                                 break;
1464                         case 8: /* -j seen */
1465                                 argv[i] = (char *)NOCATGETS("-j");
1466 #ifndef TEAMWARE_MAKE_CMN
1467                                 warning(catgets(catd, 1, 283, "Ignoring DistributedMake -j option"));
1468 #endif
1469                                 break;
1470                         case 16: /* -M seen */
1471                                 argv[i] = (char *)NOCATGETS("-M");
1472 #ifndef TEAMWARE_MAKE_CMN
1473                                 warning(catgets(catd, 1, 284, "Ignoring ParallelMake -M option"));
1474 #endif
1475                                 break;
1476                         case 32: /* -m seen */
1477                                 argv[i] = (char *)NOCATGETS("-m");
1478 #ifndef TEAMWARE_MAKE_CMN
1479                                 warning(catgets(catd, 1, 285, "Ignoring DistributedMake -m option"));
1480 #endif
1481                                 break;
1482 #ifndef PARALLEL
1483                         case 128: /* -O seen */
1484                                 argv[i] = (char *)NOCATGETS("-O");
1485                                 break;
1486 #endif
1487                         case 256: /* -K seen */
1488                                 argv[i] = (char *)NOCATGETS("-K");
1489                                 break;
1490                         case 512:       /* -o seen */
1491                                 argv[i] = (char *)NOCATGETS("-o");
1492 #ifndef TEAMWARE_MAKE_CMN
1493                                 warning(catgets(catd, 1, 311, "Ignoring DistributedMake -o option"));
1494 #endif
1495                                 break;
1496                         case 1024: /* -x seen */
1497                                 argv[i] = (char *)NOCATGETS("-x");
1498 #ifndef TEAMWARE_MAKE_CMN
1499                                 warning(catgets(catd, 1, 353, "Ignoring DistributedMake -x option"));
1500 #endif
1501                                 break;
1502                         default: /* > 1 of -c, f, g, j, K, M, m, O, o, x seen */
1503                                 fatal(catgets(catd, 1, 286, "Illegal command line. More than one option requiring\nan argument given in the same argument group"));
1504                         }
1505 
1506                         makefile_next = 0;
1507                         current_optind = optind;
1508                 }
1509         }
1510 }
1511 
1512 static void
1513 quote_str(char *str, char *qstr)
1514 {
1515         char            *to;
1516         char            *from;
1517 


1633         /* Find the number of arguments in MAKEFLAGS */
1634         while (cp && *cp) {
1635                 /* Skip white spaces */
1636                 while (cp && *cp && isspace(*cp)) {
1637                         cp++;
1638                 }
1639                 if (cp && *cp) {
1640                         /* Increment arg count */
1641                         mf_argc++;
1642                         /* Go to next white space */
1643                         while (cp && *cp && !isspace(*cp)) {
1644                                 if(*cp == (int) backslash_char) {
1645                                         cp++;
1646                                 }
1647                                 cp++;
1648                         }
1649                 }
1650         }
1651         /* Allocate memory for the new MAKEFLAGS argv */
1652         mf_argv = (char **) malloc((mf_argc + 1) * sizeof(char *));
1653         mf_argv[0] = (char *)NOCATGETS("MAKEFLAGS");
1654         /*
1655          * Convert the MAKEFLAGS string value into a vector of char *,
1656          * similar to argv.
1657          */
1658         cp = cp_orig;
1659         for (i = 1; i < mf_argc; i++) {
1660                 /* Skip white spaces */
1661                 while (cp && *cp && isspace(*cp)) {
1662                         cp++;
1663                 }
1664                 if (cp && *cp) {
1665                         cp_orig = cp;
1666                         /* Go to next white space */
1667                         while (cp && *cp && !isspace(*cp)) {
1668                                 if(*cp == (int) backslash_char) {
1669                                         cp++;
1670                                 }
1671                                 cp++;
1672                         }
1673                         tmp_char = *cp;


3003                         /* Illegal MAKEFLAGS argument */
3004                         continue;
3005                 }
3006                 if(append) {
3007                         setvar_append(name, value);
3008                         append = false;
3009                 } else {
3010                         macro = maybe_append_prop(name, macro_prop);
3011                         macro->body.macro.exported = true;
3012                         SETVAR(name, value, false)->body.macro.read_only = true;
3013                 }
3014         }
3015 }
3016 
3017 /*
3018  * Append the DMake option and value to the MAKEFLAGS string.
3019  */
3020 static void
3021 append_makeflags_string(Name name, register String makeflags_string)
3022 {
3023         const char      *option;
3024 
3025         if (strcmp(name->string_mb, NOCATGETS("DMAKE_GROUP")) == 0) {
3026                 option = NOCATGETS(" -g ");
3027         } else if (strcmp(name->string_mb, NOCATGETS("DMAKE_MAX_JOBS")) == 0) {
3028                 option = NOCATGETS(" -j ");
3029         } else if (strcmp(name->string_mb, NOCATGETS("DMAKE_MODE")) == 0) {
3030                 option = NOCATGETS(" -m ");
3031         } else if (strcmp(name->string_mb, NOCATGETS("DMAKE_ODIR")) == 0) {
3032                 option = NOCATGETS(" -o ");
3033         } else if (strcmp(name->string_mb, NOCATGETS("DMAKE_RCFILE")) == 0) {
3034                 option = NOCATGETS(" -c ");
3035         } else if (strcmp(name->string_mb, NOCATGETS("PMAKE_MACHINESFILE")) == 0) {
3036                 option = NOCATGETS(" -M ");
3037         } else if (strcmp(name->string_mb, NOCATGETS("DMAKE_OUTPUT_MODE")) == 0) {
3038                 option = NOCATGETS(" -x DMAKE_OUTPUT_MODE=");
3039         } else if (strcmp(name->string_mb, NOCATGETS("SUN_MAKE_COMPAT_MODE")) == 0) {
3040                 option = NOCATGETS(" -x SUN_MAKE_COMPAT_MODE=");
3041         } else {
3042                 fatal(catgets(catd, 1, 289, "Internal error: name not recognized in append_makeflags_string()"));
3043         }