static void warnDepricatedSerialFlag(ArgumentState* arg_state, char* unused) { if (fSerial) { USR_WARN("--serial is currently not fully supported and may be deprecated in future releases"); } else { USR_WARN("the --no-serial flag may be deprecated in future releases"); } }
static void postStackCheck() { if (!fNoStackChecks && fUserSetStackChecks) { if (strcmp(CHPL_TASKS, "massivethreads") == 0) { USR_WARN("CHPL_TASKS=%s cannot do stack checks.", CHPL_TASKS); } } }
static void postTaskTracking() { if (fEnableTaskTracking) { if (strcmp(CHPL_TASKS, "fifo") != 0) { USR_WARN("Enabling task tracking with CHPL_TASKS=%s has no effect other than to slow down compilation", CHPL_TASKS); } } }
// Mark the variables listed in 'with' clauses, if any, with tiMark markers. // Same as markOuterVarsWithIntents() in implementForallIntents.cpp, // except uses byrefVars instead of forallIntents. static void markOuterVarsWithIntents(CallExpr* byrefVars, SymbolMap& uses) { if (!byrefVars) return; Symbol* marker = NULL; // Keep in sync with setupForallIntents() - the actuals alternate: // (tiMark arg | reduce opExpr), task-intent variable [, repeat] for_actuals(actual, byrefVars) { SymExpr* se = toSymExpr(actual); INT_ASSERT(se); // comes as an UnresolvedSymExpr from the parser, // should have been resolved in ScopeResolve // or it is a SymExpr over a tiMark ArgSymbol // or over chpl__reduceGlob Symbol* var = se->symbol(); if (marker) { SymbolMapElem* elem = uses.get_record(var); if (elem) { elem->value = marker; } else { if (isVarSymbol(marker)) { // this is a globalOp created in setupOneReduceIntent() INT_ASSERT(!strcmp(marker->name, "chpl__reduceGlob")); USR_WARN(byrefVars, "the variable '%s' is given a reduce intent and not mentioned in the loop body - it will have the unit value after the loop", var->name); } } marker = NULL; } else { marker = var; INT_ASSERT(marker); // otherwise the alternation logic will not work } }
static void setPrintPassesFile(const ArgumentDescription* desc, const char* fileName) { printPassesFile = fopen(fileName, "w"); if (printPassesFile == NULL) { USR_WARN("Error opening printPassesFile: %s.", fileName); } }
static void checkTargetArch() { if (specializeCCode && (strcmp(CHPL_TARGET_ARCH, "unknown") == 0)) { USR_WARN("--specialize was set, but CHPL_TARGET_ARCH is 'unknown'. If " "you want any specialization to occur please set CHPL_TARGET_ARCH " "to a proper value."); } }
static void checkIncrementalAndOptimized() { std::size_t optimizationsEnabled = ccflags.find("-O"); if(fIncrementalCompilation && ( optimizeCCode || optimizationsEnabled!=std::string::npos )) USR_WARN("Compiling with --incremental along with optimizations enabled" " may lead to a slower execution time compared to --fast or" " using -O optimizations directly."); }
static void postStaticLink() { if (fLinkStyle == LS_STATIC) { if (strcmp(CHPL_TARGET_PLATFORM, "darwin") == 0) { USR_WARN("Static compilation is not supported on OS X, ignoring flag."); fLinkStyle = LS_DEFAULT; } } }
static void setStaticLink(const ArgumentState* state, const char* arg_unused) { if (strcmp(CHPL_TARGET_PLATFORM, "darwin") == 0) { USR_WARN("Static compilation is not supported on OS X, ignoring flag."); fLinkStyle = LS_DEFAULT; } else { fLinkStyle = LS_STATIC; } }
static void setupDependentVars(void) { if (developer && !userSetCppLineno) { printCppLineno = false; } #ifndef HAVE_LLVM if (llvmCodegen) USR_FATAL("This compiler was built without LLVM support"); #endif if (specializeCCode && (strcmp(CHPL_TARGET_ARCH, "unknown") == 0)) { USR_WARN("--specialize was set, but CHPL_TARGET_ARCH is 'unknown'. If " "you want any specialization to occur please set CHPL_TARGET_ARCH " "to a proper value."); } }
static void setupChplHome(const char* argv0) { const char* chpl_home = getenv("CHPL_HOME"); char* guess = NULL; // Get the executable path. guess = findProgramPath(argv0); if (guess) { // Determine CHPL_HOME based on the exe path. // Determined exe path, but don't have a env var set // Look for ../../../util/chplenv // Remove the /bin/some-platform/chpl part // from the path. if( guess[0] ) { int j = strlen(guess) - 5; // /bin and '\0' for( ; j >= 0; j-- ) { if( guess[j] == '/' && guess[j+1] == 'b' && guess[j+2] == 'i' && guess[j+3] == 'n' ) { guess[j] = '\0'; break; } } } if( isMaybeChplHome(guess) ) { // OK! } else { // Maybe we are in e.g. /usr/bin. free(guess); guess = NULL; } } if( chpl_home ) { if( strlen(chpl_home) > FILENAME_MAX ) USR_FATAL("$CHPL_HOME=%s path too long", chpl_home); if( guess == NULL ) { // Could not find exe path, but have a env var set strncpy(CHPL_HOME, chpl_home, FILENAME_MAX); } else { // We have env var and found exe path. // Check that they match and emit a warning if not. if( ! isSameFile(chpl_home, guess) ) { // Not the same. Emit warning. USR_WARN("$CHPL_HOME=%s mismatched with executable home=%s", chpl_home, guess); } // Since we have an enviro var, always use that. strncpy(CHPL_HOME, chpl_home, FILENAME_MAX); } } else { if( guess == NULL ) { // Could not find enviro var, and could not // guess at exe's path name. USR_FATAL("$CHPL_HOME must be set to run chpl"); } else { int rc; if( strlen(guess) > FILENAME_MAX ) USR_FATAL("chpl guessed home %s too long", guess); // Determined exe path, but don't have a env var set strncpy(CHPL_HOME, guess, FILENAME_MAX); // Also need to setenv in this case. rc = setenv("CHPL_HOME", guess, 0); if( rc ) USR_FATAL("Could not setenv CHPL_HOME"); } } // Check that the resulting path is a Chapel distribution. if( ! isMaybeChplHome(CHPL_HOME) ) { // Bad enviro var. USR_WARN("CHPL_HOME=%s is not a Chapel distribution", CHPL_HOME); } if( guess ) free(guess); parseCmdLineConfig("CHPL_HOME", astr("\"", CHPL_HOME, "\"")); }
void WhileStmt::checkConstWhileLoop() { if (loopBodyHasExits() == false) USR_WARN(this, "A while loop with a constant condition"); }
static void handleStackCheck(const ArgumentState* state, const char* unused) { if (!fNoStackChecks && strcmp(CHPL_TASKS, "massivethreads") == 0) { USR_WARN("CHPL_TASKS=%s cannot do stack checks.", CHPL_TASKS); } }
void VarSymbol::codegenGlobalDef(bool isHeader) { GenInfo* info = gGenInfo; if( id == breakOnCodegenID || (breakOnCodegenCname[0] && 0 == strcmp(cname, breakOnCodegenCname)) ) { gdbShouldBreakHere(); } if( info->cfile ) { codegenDefC(/*global=*/true, isHeader); } else { #ifdef HAVE_LLVM if(type == dtVoid || !isHeader) { return; } if( this->hasFlag(FLAG_EXTERN) ) { // Make sure that it already exists in the layered value table. if( isType() ) { llvm::Type* t = info->lvt->getType(cname); if( ! t ) { // TODO should be USR_FATAL USR_WARN(this, "Could not find extern def of type %s", cname); } } else { GenRet v = info->lvt->getValue(cname); if( ! v.val ) { // TODO should be USR_FATAL // Commenting out to prevent problems with S_IRWXU and friends // USR_WARN(this, "Could not find extern def of %s", cname); } } } else { bool existing; existing = (info->module->getNamedValue(cname) != NULL); if( existing ) INT_FATAL(this, "Redefinition of a global variable %s", cname); // Now, create a global variable with appropriate linkage. llvm::Type* llTy = type->codegen().type; INT_ASSERT(llTy); llvm::GlobalVariable *gVar = new llvm::GlobalVariable( *info->module, llTy, false, /* is constant */ hasFlag(FLAG_EXPORT) ? llvm::GlobalVariable::ExternalLinkage : llvm::GlobalVariable::InternalLinkage, llvm::Constant::getNullValue(llTy), /* initializer, */ cname); info->lvt->addGlobalValue(cname, gVar, GEN_PTR, ! is_signed(type) ); if(debug_info){ debug_info->get_global_variable(this); } } #endif } }
static void handleTaskTracking(const ArgumentState* state, const char* unused) { if (fEnableTaskTracking && strcmp(CHPL_TASKS, "fifo") != 0) { USR_WARN("Enabling task tracking with CHPL_TASKS=%s has no effect other than to slow down compilation", CHPL_TASKS); } }